Given this document:
{
"k1": "v1",
"k2": "v2",
"k3": "v3",
"k4": {
"k4.1": "v4.1",
"k4.2": "v4.2",
"k4.3": "v4.3"
}
}
I need to extract this subset, in this exact form:
{
"k2": "v2",
"k3": "v3",
"k4.1": "v4.1"
"k4.2": "v4.2"
}
But despite searching/experimenting for over a day, I am unable to discern the proper incantation.
This expression: $['k2', 'k3']
gives me the two top level elements:
{
"k2" : "v2",
"k3" : "v3"
}
And this expression: $['k4']['k4.1','k4.2']
gives me the two nested elements:
{
"k4.1" : "v4.1",
"k4.2" : "v4.2"
}
But how to combine these two expressions into one that includes the results from multiple levels?
Unfortunately the nature of the tool I am using (AWS State Language paths) demands that this be done with a single xpath expression.