I have a json like this:
{
"A": [
{
"B": [
{
"status": "2",
"value": "1"
},
{
"status": "1",
"value": "2"
},
{
"status": "3",
"value": "4"
},
{
"status": "5",
"value": "8"
}
]
}
]
}
I want to extract the field value.
I tried doing
spath input=field_name output=value path=A{0}.B{}.value
but it's not working
Pls help
Works for me.
| makeresults
| eval json="{
\"A\": [
{
\"B\": [
{
\"status\": \"2\",
\"value\": \"1\"
},
{
\"status\": \"1\",
\"value\": \"2\"
},
{
\"status\": \"3\",
\"value\": \"4\"
},
{
\"status\": \"5\",
\"value\": \"8\"
}
]
}
]
}"
| spath input=json path="A{}.B{}.value" output=vals
You forgot to put the path in quotes.