Anthony Lucia
asked on
JSONPath and array
I have the following JSON object.
As you can see, its encased in brackets, and therefore an array.
If there were no brackets I could easily get the 444 value with the following command
However, I do not seem to be able to get the value of the from JSONPath with the enclosed brackets included in the JSON object.
How do I format a JSONPath statement that will return 444 from the JSON object of
Thanks
[{"1":444}]
As you can see, its encased in brackets, and therefore an array.
If there were no brackets I could easily get the 444 value with the following command
$.1
However, I do not seem to be able to get the value of the from JSONPath with the enclosed brackets included in the JSON object.
How do I format a JSONPath statement that will return 444 from the JSON object of
[{"1":444}]
Thanks
Your key name should not start with a number. Javascript identifiers should not start with a number.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the "1" that is a string gets used as a name for a variable in javascript, then it will be wrong. I'm pretty sure that's my point. Identifiers in javascript such as variable names and 'id's for HTML elements are not supposed to start with a number. I suspect that applies to names used as identifiers in arrays too.
If the "1" that is a string gets used as a name for a variable in javascript, then it will be wrong.That I do agree with.