Above is a picture of the JSON data being returned by the API. As you can see some of the JSON keys have two words with a space in between them. How can I access that in my angular app. This is coming in as an array BTW.
I have tried:
<li ng-repeat="task in mainTask.Tasks"> {{ task.['CAR ID'] }} </li>
with no luck. Thanks for any help.
Whitespace (Space, Horizontal tab, Line feed or New line or Carriage return) does not matter in JSON. It can also be minified with no affect to the data. Object literal names MUST be lowercase (ie – null, false, true etc). Keep all name and value pairs in quotes to aviod.
JSON conventions¶ Format JSON files to be human readable. Use four spaces for indentation (matching OpenStack conventions used in Python and shell scripts). Do not use tab characters in the code, always use spaces. Use one space after the name-separator (colon).
JSON only supports several types of objects as item keys, which are str , int , float , bool and None .
You don't need the dot to access the value. Try:
{{ task['CAR ID'] }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With