JSON Pointer · lesson 1 of 6 · Basics
What is a JSON Pointer?
A JSON Pointer (RFC 6901) is a string that names exactly one value in a document. Every step starts with / and is either an object key or an array index.
Examples
Example 1Walk down to one value
Document
{
"store": {
"book": [
{ "title": "Moby Dick", "price": 8.99 },
{ "title": "Ulysses", "price": 12.5 }
],
"bicycle": { "color": "red" }
}
}Query
/store/bicycle/color
/storeStep into thestorekey./bicycleThen intobicycle./colorThencolor— the one value the pointer names →"red".
Result
"red"
Good to know
- The empty pointer (no characters at all) names the whole document.
- A lone
/names the key""— an empty-string key, which JSON allows. - In the playground, a query that starts with
/is auto-detected as a JSON Pointer.