krammer krammer - 3 months ago 10
JSON Question

Parsing JSON with spaces in key name with AngularJS

I have a json which has spaces in key names.

The JSON has the following format

"my name":"krammer",
"job": "stackexchange"

While using ng-repeat to get the parameters into a list, I use the following code

{{friends.['my name']}}

But this gives an empty output. While name

gives an error.

So how can the key names with empty spaces be accessed using AngularJS ?


Please try this

{{friends['my name']}}