[solved] Special Character in JSON object/array


#1

Hi,

I’m quite new to Meteor and have been searching for an answer for a while now, but don’t seem to be able to find a solution.

Through a HTTP.get a JSON set is returned. The JSON is nested and i’m trying to display the returned JSON into a e.g. table.

The first first problem I encounter is, that one on the nested arrays has a special character in it. The data looks something like this:

{
   "_embedded" : {
      "nested:array" : [
         {
            "_links" : {
               "collection" : {
                  "data" : null
                }
            },
            "return_code" : "200",
            "return_id" : "bla",
        }
    }
}

My issue lies with the nested:array object. What i’m trying:

var json = JSON.parse(result.content);
//this will result everything
console.log(json);

//This will result the _embedded object
console.log(json._embedded);

My question is, how to display the “nested:array” information.

console.log(json._embedded.nested:array[]);

won’t work because of the “:” in the array.

Any ideas on how to do this?

Kind regards,
Maikel


#2

console.log(json._embedded['nested:array']);


#3

Of all the things I tried, that was not one of them. :sweat_smile:
And it wasn’t hard to think off.

Thank you!