From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-03-2023 06:32 AM
I'm using JSONtext to retrieve data from a JSON file (JSON from another source).
The JSON items have dots in their name, for example:
{
"Header": {
"ecat.cmd": [
"04",
16,
4
],
...
When using $. path notation, the dots represents breaks between names, but above you can see an entity with a dot in the name itself, so this doesn't work:
Google suggests that you can escape the dot in the JSON path: $.Header.ecat\.cmd
Also, it suggests you can encapsulate: %.Header.\"ecat.cmd\"
Neither works. Is there an expected nomenclature for this in JSONtext?
Solved! Go to Solution.
04-03-2023 10:54 AM
Try this:
$.Header."ecat.cmd"
04-03-2023 12:22 PM
This is how it is described in the extended help (though perhaps this is not clear enough):
Object items can also be specified as their proper JSON string. This allows the use of characters in names that would otherwise not parse correctly. For example:
$."My Name that contains \"quotes\", []brackets, and dots."
Note that this must be proper JSON (thus the escaped quotes in the example).
Note that JSONpath doesn't have an actual specification, so I have not held to anyone else's ideas too closely. Rather than make up a whole set of escaping rules specific to JSONpath, I instead defined the path as using JSON Strings, with unquoted LabVIEW strings as an option, just for convenience. The real path is $."Header"."ecat.cmd".
04-03-2023 04:52 PM
Thanks. Now that you've explained it I can see what the help means, but I think I would never have realised otherwise. It could use some rework, maybe breaking the example into three and showing that quotes around the names are equally valid (and arguably better).