JSONPAth expression tester

Posted on 2014-07-14
Last Modified: 2014-07-14
I am reading about JSONPath script from th efollowing site

Open in new window

So I went to the JSON tester site

Open in new window

and entered the following into the JSON Data seciont

{ "identification" : "AlphaBeta" }

Open in new window

Then I entered the following into the JSON Expression section:


Open in new window

That resulted in the following in the 'Results' section:


Open in new window

My question:  Why does it place a begining bracket '[', and a closing bracket '].

Why doesnt it just report the following:


Open in new window

Question by:Anthony Lucia
    LVL 30

    Accepted Solution

    I'm no expert on that jsonPath but it seems like the result can be a set of matches.
    I mean, your "query" can have multiple result, that's why the result is a collection.
    LVL 30

    Expert Comment

    by:Alexandre Simões
    Although you don't need to use fancy libraries for this specific case you're doing.
    For your JSON object you can simply do:
    var json = { "identification" : "AlphaBeta" };
    // get identification
    var option1 = json.identification;    // returns: AlphaBeta
    var option2 = json['identification']; // returns: AlphaBeta
    // if you ask for a property that doesn't exist you'll get undefined
    var option1 =;    // returns: undefined
    var option2 = json['name']; // returns: undefined

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    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 about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now