0

anyone can help please with this puzzle?

This is my json snippet:

{
"Meas": [
    {
        "@TyCd": "ACT",
        "H": {
            "$": 69.0,
            "@Uom": "CM"
        },
        "L": {
            "$": 116.0,
            "@Uom": "CM"
        },
        "VolWgt": {
            "$": 131.266,
            "@Uom": "KG"
        },
        "W": {
            "$": 82.0,
            "@Uom": "CM"
        },
        "Wgt": {
            "$": 156.5,
            "@Uom": "KG"
        }
    },
    {
        "@TyCd": "DEC",
        "H": {
            "$": 66.0,
            "@Uom": "CM"
        },
        "L": {
            "$": 120.0,
            "@Uom": "CM"
        },
        "W": {
            "$": 80.0,
            "@Uom": "CM"
        },
        "Wgt": {
            "$": 155.8,
            "@Uom": "KG"
        }
    }
]

}

And in my my case I need to filter values for @TyCd='ACT', Im trying something like this: Meas[?(@.@TyCd=="ACT")]=='ACT' but it is not working obviously...

So any JSON Guru who can help to access json element with '@'?

THANKS!

Jan Rohan
  • 13
  • 3

1 Answers1

0

So I found the solution using jsonpath.com

This is how i achive the result: $..['Meas'][?(@['\x40TyCd'] == 'ACT')]

With help of this post: Escape string for javascript: hex in json and thisone as well: How do you escape the @ symbol in jsonpath?

Jan Rohan
  • 13
  • 3