alkutin / jsonpath

Automatically exported from code.google.com/p/jsonpath
0 stars 0 forks source link

Attempting to access a property value with an @ sign. #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Attempting to access a property value with an @ sign.

The query is dynamically built and needs to be able to evaluate any string. 
What steps will reproduce the problem?
1. Using this object

{
"report": {
    "Author": [
        {
            "value": "John",
            "count": "58",
            "fields": [
                {
                    "key": "FileSize",
                    "value": "12314"

                },
                {
                    "key": "Date",
                    "value": "2000-01-01"
                }
            ]
        },
        {
            "value": "Jane",
            "count": "1",
            "fields": [
            ]
        },
        {
            "value": "Foo@bar.com",
            "count": "58",
            "fields": [
                {
                    "key": "FileSize",
                    "value": "12314"

                },
                {
                    "key": "Date",
                    "value": "2000-01-01"
                },
                {
                    "key": "tags",
                    "value": "a,b,c,d"
                }         
            ]
        },
        {
            "value": "Bill",
            "count": "2",
            "fields": [
                {
                    "key": "FileSize",
                    "value": "14"

                }
            ]
        }
    ]
}
}

2. Using this path

$.report.Author[?(@.value==='Foo@bar.com')]

What is the expected output? What do you see instead?
Expected - [{
            "value": "Foo@bar.com",
            "count": "58",
            "fields": [
                {
                    "key": "FileSize",
                    "value": "12314"

                },
                {
                    "key": "Date",
                    "value": "2000-01-01"
                },
                {
                    "key": "tags",
                    "value": "a,b,c,d"
                }         
            ]
        }]

Actual result - False

What version of the product are you using? On what operating system?
JSONPath 0.8.0
Windows Server 2008 R2 - IIS 7.5

Please provide any additional information below.

I've also tried 
$.report.Author[?(@.value==='\Foo@bar.com\')] with no luck.

Since the value can actually be any string I can't escape in string.

Original issue reported on code.google.com by Medros1...@gmail.com on 1 Oct 2012 at 7:02