JSONPath referencing a JSON array

Posted on 2014-07-15
Medium Priority
Last Modified: 2014-07-16
I have the following JSON object.


Open in new window

As you can see, its encased in brackets, and therefore an array.

If there were no brackets I could easily get the 123 value with the following command


Open in new window

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.

I checked on a validator and the JSON object is valid.  I looked up several JSONPath sites, but I could not find out how to dereference this strange array

How do I format a JSONPath statement that will return 123 from the JSON object of


Open in new window

Question by:Anthony Lucia

Accepted Solution

Liam Martens earned 2000 total points
ID: 40198088
In plain Javascript you could do the following:
var foo = [{"ID":"123"}];
var ID = foo[0].ID;

Open in new window

foo[0] will reference to the JSON object in the array object, being the first element (index 0), then inside the JSON Object you can use the key of the key value pairs to return it's value.

Author Closing Comment

by:Anthony Lucia
ID: 40199440
Thanks to your help I was able to get this in pure JSONPath with the following:


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question