Skip to content

Discrepancy with reference implementation - same result for $.store and $.store.* #28

@maxlinc

Description

@maxlinc

I noticed a discrepancy between this project and the original PHP implementation of JSONPath by Stefan Gössner. This project gives the same result for $.store and $.store.*, while the original PHP implementation returns different results.

Additionally, I can't figure out a workaround. Is there a jsonpath that would give me an equivalent result (values only instead of the full object)?

I tested this with the sample data from the original original jsonpath article:

{ "store": {
    "book": [ 
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}

I saved that to store.json and tested with:

jsonpath '$.store' store.json
jsonpath '$.store.*' store.json

and compared with the results at http://jsonpath.curiousconcept.com/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions