1
{
    "key" : "value",
    "array.fruits" : [
        { "key" : 1 },
        { "key" : 2, "dictionary": {
                "a": "Apple",
                "b": "Butterfly",
                "c": "Cat",
                "d": "Dog"
            } },
        { "key" : 3 }
    ]
}

How to parse the key 'array.fruits' in json query.

Kobi
  • 2,494
  • 15
  • 30

1 Answers1

1

You can use the bracket notation property accessor in order to get to the value you need:

const data = {
    "key" : "value",
    "array.fruits" : [
        { "key" : 1 },
        { "key" : 2, "dictionary": {
                "a": "Apple",
                "b": "Butterfly",
                "c": "Cat",
                "d": "Dog"
            } },
        { "key" : 3 }
    ]
}

console.dir(data["array.fruits"])
OliverRadini
  • 6,238
  • 1
  • 21
  • 46