JSONPath for Keys That Contain Dots: Literal Keys vs. Nested Fields
Query a print proof export in CodeBench to tell a dotted key from a nested field, distinguish missing readings from null and zero, and trace matches back to their records.

A print shop is checking the first proof batch after a reporting change. The export still carries the press reading under a flat column name, ink.black, while a newer section stores the target for the same ink under ink, then black. A reviewer copies a path from an old ticket, gets 0.46, and writes it down as what the press measured. The query ran successfully. The problem is that 0.46 is the target; the press recorded 0.72 for that proof.
Both values can sit on the same JSON object. The dot inside the quoted JSON member name is ordinary text; a dot in an unquoted JSONPath segment tells the query where to descend. You need to get that distinction right before you can answer the shop's next question: which proofs actually have a recorded reading? The examples below use one batch so you can trace the wrong value and the missing entries without changing the input between runs.
Load one batch with four different records
Open the JSON Path Tester and replace the sample in JSON Data with the export below. Use the expression box beside the dollar sign and set Result: to Values. Paste each expression in full, including its leading $; the dollar sign next to the box is a label, not part of the editable text. The tool reevaluates shortly after an edit, or you can press Command+Enter on macOS or Ctrl+Enter to run it immediately. Read the Results pane together with the match badge.
{
"prints": [
{ "id": "N-3", "ink.black": 0.72, "ink": { "black": 0.46 } },
{ "id": "K-8", "ink.black": null },
{ "id": "M-2" },
{ "id": "P-4", "ink.black": 0 }
]
}
In this fictional export, the flat member is a measured value on a normalized scale. The shop uses null when a reading is expected but not yet available; a record with no measurement member has not supplied that field at all. A numeric zero is a recorded measurement, not an indication of missing data. Those meanings belong to this export's contract. JSON can show that a field is absent or explicitly null, but it cannot tell you why a particular producer left it that way.
Notice that the record with the missing member sits before the measured zero, not at the end. That's deliberate: the export preserves a place for each proof in prints, but a query for a field need not return anything for that place. We'll use that gap to catch a second bug after fixing the spelling of the path.
Measure the difference between one key and two
First, ask for the flat press readings. The prefix $.prints[*] starts at the document root and visits each element in prints. The quoted bracket selector then looks up one member whose exact name is ink.black. It does not split that name at the dot.
$.prints[*]['ink.black']
The badge reads 3 matches and Results shows:
[
0.72,
null,
0
]
Keep the prefix and change the selector after the wildcard. This time .ink.black looks for the member ink on each proof and then the member black inside it. It does not fall back to the flat spelling if ink isn't there.
$.prints[*].ink.black
The badge reads 1 match and Results shows:
[
0.46
]
The first proof is the useful test case. If the file had only flat keys, a mistaken nested query might give you an empty array and send you looking for a typo. Here the wrong query returns a plausible number from the very record you wanted. Even a nonempty check passes. If you're writing a regression fixture for the report, keep both members on that record and give them different values. Otherwise the test might still pass after someone replaces the bracket selector with dot notation.
You can see the boundary between names by changing Result: to Paths without editing the expression. For the nested query the pane shows a single string at the source location below. Each quoted bracket names one member; brackets aren't restricted to names containing punctuation. The normalized form just makes the two steps unmistakable.
[
"$['prints'][0]['ink']['black']"
]
If you're adapting a query from a spreadsheet heading, check the raw JSON before translating that heading into selectors. The column label could have been copied verbatim into a member name, or generated by flattening an object for display. In this export you can settle the question by looking at where each member name ends on N-3: one follows the full quoted name "ink.black", and the other follows "ink" and introduces an object. The colon after "black" belongs to that inner object. Neither the printed heading nor the returned number tells you which structure you're reading.
Compare null, no match, and zero on individual proofs
Switch back to Values. Replace [*] with an explicit index to remove the ambiguity about which proof you're looking at. The indices start at zero, so [1] selects the second record, K-8. Run these three expressions separately against the unchanged export. The table shows the JSON content of Results compactly; the tool puts each matched element on its own line.
| Expression | Proof | Results | Badge |
|---|---|---|---|
$.prints[1]['ink.black'] |
K-8 | [null] |
1 match |
$.prints[2]['ink.black'] |
M-2 | [] |
0 matches |
$.prints[3]['ink.black'] |
P-4 | [0] |
1 match |
On K-8 the query selected a member and the value it found was null. On M-2 the query found no such member, although the proof itself exists. The tool does not insert a null as a placeholder. On P-4 the selected member contains the number 0; the badge says 1 match, not 0 matches. Clearing the expression is not a substitute for the M-2 check: an empty expression clears the pane and removes the badge, whereas a successful lookup with no match displays [] and keeps the zero count visible.
For the shift report, the distinction changes what someone does next. K-8 goes on the list of readings to collect; M-2 needs a check against the exporter because the field wasn't supplied. P-4 keeps its measured zero and can be judged against whatever threshold applies. If you use a truthiness check to decide whether a result exists, you collapse that last case into the first two. If you count matches as numeric readings, you count K-8 as measured. In this batch the flat query finds three members, but only two of them contain numbers.
Put the zero back on the right proof
Suppose the reviewer pulls the IDs with $.prints[*].id. In Values, that produces ["N-3", "K-8", "M-2", "P-4"]. It looks tempting to line that list up with [0.72, null, 0]: the first two pairs look right, and then the zero lands next to M-2. The readings array has no slot for M-2, so its third element actually comes from the fourth proof. Padding the end of the shorter list doesn't fix a hole in the middle.
Run $.prints[*]['ink.black'] again and switch Result: to Paths. The tool replaces the values with the matched locations rather than adding a path column. The badge still reads 3 matches:
[
"$['prints'][0]['ink.black']",
"$['prints'][1]['ink.black']",
"$['prints'][3]['ink.black']"
]
Read the index inside each path, not the position of the path string in the output. The final location has [3], so look at the fourth proof in JSON Data. To double check in the tool, switch back to Values and run $.prints[3].id. The result is ["P-4"] with 1 match. The missing [2] in the paths is what the values alone couldn't show. If you need to keep a record of the check, Copy copies the currently displayed array; copy each mode separately without changing the query or the JSON between them. Keep that snapshot with the accepted report mapping.
A source index is useful for tracing a result within this exact export. It isn't a proof identifier you can carry over to tomorrow's batch, which might contain the same proofs in a different order. When the report needs one row per proof, start from the original prints records and keep the ID with each field check. Assign a reporting state for absent members, another for explicit nulls, and keep numeric values intact. Use the paths to audit the extraction, not as IDs for joining separate exports.
Check the index in Paths before drawing a conclusion from a count that looks right. As a quick cross check, try those three indexed queries again in Paths. K-8 still gives you a location, $['prints'][1]['ink.black'], even though there is no number there. P-4 gives you $['prints'][3]['ink.black']. M-2 still gives you []. If a reporting script claims to have extracted a reading from M-2, ask it to show the source location. A row in a downstream spreadsheet is not evidence that the member existed upstream.
Keep the example that would have caught the bug
When the shop updates its mapping, the reviewer can leave a short acceptance check with the sample. The recorded value for N-3 must be 0.72, even though the nested target returns a number too. K-8 must be marked as awaiting a reading, and M-2 must be flagged for an omitted field. P-4 must remain a numeric zero under its own ID. These assertions check the meaning of the report, not just whether the query parses or returns something.
Try one last edit to model an exporter that drops null fields. Remove , "ink.black": null from K-8, leaving its ID and the other proofs untouched. Run the flat wildcard query in Values again. It now returns [0.72, 0] with 2 matches. The count of numeric readings didn't change, but the count of selected members did. In Paths, the locations have indices [0] and [3]. That is the difference a report should surface if a serializer starts omitting nulls. A comparison that checks only numeric readings would miss the change entirely. Restore the original export if you want to repeat the indexed checks.
If a later export really does move the measurement to the nested location, confirm that contract before changing the selector. In this batch the two names don't represent interchangeable copies, and filling a missing measurement from the target would invent a reading the press never supplied. A good review question is whether the report can point to the source member for every value it prints. Here the brackets settle which member was selected, the match count distinguishes a present value from no selection, and the path tells you which proof the selection came from.