Polish JSON field path bracket notation contribution

Closes gh-131
This commit is contained in:
Andy Wilkinson
2015-09-22 16:58:51 +01:00
parent f3b83f977e
commit 42aa996277
3 changed files with 40 additions and 24 deletions

View File

@@ -92,10 +92,14 @@ must be compatible with `application/xml`.
[[documenting-your-api-request-response-payloads-json-field-paths]]
===== JSON field paths
JSON field paths use `.` or bracket notation to descend into a child object and `[]` to
identify an array. Using bracket notation enables the use of `.` within a key name.
JSON field paths use either dot notation or bracket notation. Dot notation uses '.' to
separate each key in the path; `a.b`, for example. Bracket notation wraps each key in
square brackets and single quotes; `['a']['b']`, for example. In either case, `[]` is used
to identify an array. Dot notation is more concise, but using bracket notation enables the
use of `.` within a key name; `['a.b']`, for example. The two different notations can be
used in the same path; `a['b']`, for example.
For example, with this JSON payload:
With this JSON payload:
[source,json,indent=0]
----