Skip to content

JSON Path

JSON paths are used throughout the API to identify values in JSON documents. A JSON Path can an object property or all properties, an array or a specific element an array. Paths are string values and always start with $. Using the following JSON documents as a reference, see the sample paths below:

JSON Object

{
    "name" : "Joe",
    "age" : 34,
    "address" : {
      "street" : "123 Main St",
      "city" : "New York",
      "state": "New York"
    },
    "favoriteNumbers": [ 5,7,9,21,100 ],
    "favoriteColors": [ "Blue", "Green" ]
}

Sample paths:

Path
Reference value
$.name
"Joe"
$.age
34
$.address.*
[
"street" : "123 Main St",
"city" : "New York",
"state": "New York"
]
$.address.street
"123 Main St"
$.favoriteNumbers[*]
[ 5,7,9,21,100 ]
$.favoriteNumbers[0]
5
$**.city
[ "New York" ]

JSON Array

[ 
 "abc", 
 [{"k": "10"}, "def"], 
 {"x":"abc"}, 
 {"y":"bcd"}
]

Sample paths:

Path
Reference value
$[0]
"abc"
$[1][0]
{ "k": "10" }
$[1][0].k
10
$[2].x
"abc"
$[*]
[
"abc",
[{"k": "10"}, "def"],
{"x":"abc"},
{"y":"bcd"}
]
$[1][*]
[
{ "k": "10" },
"def"
]

When JSON path is used to identify JSON data for a document stored in Backendless database, it must be enclosed into single quotes and prefixed with:

 columnName->'json-path-here'