I have some trouble selecting data from json, most key names contain dashes and jsonata does not seem to play along with it.
Example source (reality is much longer, many interfaces)
{
"rpc-reply": {
"$": {
"xmlns:junos": "http://xml.juniper.net/junos/12.1X47/junos"
},
"interface-information": [
{
"$": {
"xmlns": "http://xml.juniper.net/junos/12.1X47/junos-interface",
"junos:style": "terse"
},
"physical-interface": [
{
"name": [
"ge-0/0/0"
],
"admin-status": [
"up"
],
"oper-status": [
"up"
],
"logical-interface": [
{
"name": [
"ge-0/0/0.0"
],
"admin-status": [
"up"
],
"oper-status": [
"up"
],
"filter-information": [
"\n "
]
}
]
},
{
"name": [
"gr-0/0/0"
],
"admin-status": [
"up"
],
"oper-status": [
"up"
]
},
{
"name": [
"ip-0/0/0"
],
"admin-status": [
"up"
],
"oper-status": [
"up"
]
}
]
}
]
}
}
I want to select from physical-interface
, its admin-status
where the literal name is ge-0/0/0
.
Trying JSONata:
*["physical-interface"] // result - all
*["physical-interface"].name // no result
*["physical-interface"][name='ge-0/0/0'] // no result
*["physical-interface"]['name'='ge-0/0/0'] // no result
*["physical-interface"][name='ge-0/0/0'].['admin-status'] // no result
**.name // 2 results
How does it work ? Does it work ? Or should i replace all keynames first ?