Find values and reusable paths in a JSON event list
Admin ·
An event coordinator receives a JSON schedule with four entries, including a studio event whose talk is still undecided. Use JSONPath to pick every other listing starting at the second entry and see the exact values returned.
Select two events and keep their paths
Select Load event example and test the query below. The slice starts at index 1, stops before index 4 and advances two places at a time. The two matches are the talk at index 1, Plan a seed swap, and null at index 3.
Select Use path on the second match and rerun the query. The bracket path $['events'][3]['talk'] returns exactly one value, null. Change talk to title and rerun to see how a missing member produces zero matches.
$.events[1:4:2].talkCompare lookup paths against the same document
Enter the two queries below on separate lines. Both report the Studio room at index 3. The first names the last event regardless of how many events there are. The second keeps selecting index 3 if someone appends another event.
Add a third line with $.missing to compare a valid query that returns zero matches. The exported report groups matches by query and keeps the original line numbers. Blank lines are skipped. A malformed query gets its own diagnostic so you can keep reviewing results from the other lines.
$.events[-1].room
$.events[3].roomChoose selectors that fit the document
Use $.events[-1] for the final event and $.events[*].room for the rooms in array order. Use $..talk to look for the talk name at any depth. A key containing a dot needs brackets and quotes. For example, $['event.name'] matches one key whose name contains a dot.
The tool accepts selector lists, such as $.events[0,2].room, and reverse slices, such as $.events[::-1]. Filter expressions and function selectors require a tool that implements those parts of RFC 9535.
Verify the exported values
Download matches to get an array with a path and value per entry. If an event ID is 9007199254740993, that same literal appears in the exported JSON. Software that converts it to a binary floating-point number may round it when reading the file.
The tool rejects repeated object keys because one path could otherwise identify several sibling values. Open the original source at the reported character offset and decide which value belongs there before rerunning the query.
RFC 9535, JSONPath query expressions and normalized pathsRFC 8259, JSON data interchange format
Common questions
How is JSONPath different from JSON Pointer?
A JSON Pointer such as /events/0/room names a single location. A JSONPath query can select a list of nodes, for example $.events[*].room.
What order does an object wildcard use?
The workspace shows object members in source order. JSONPath does not prescribe an order for object children, so another implementation can return them in a different order.