I have a complex JSON Structure . I wan't to exclude a part and get the list in two buckets. Say One as "inclusions" and another as "exclusions". Sample JSON is given below.
{
"Item": {
"Items": [{
"Items": [{
"category": "fruit",
"Item": {
"Items": [{
"Text": "Apple"
},
{
"Text": "Orange"
},
{
"Text": "Grapes"
},
{
"Text": "Guava"
}],
"Types": ["Value",
"Value",
"Value",
"Value"]
},
"Type": "Or"
},
{
"category": "fruit",
"Item": {
"Text": "Pineapple"
},
"Type": "Value"
}],
"Types": ["Constraint",
"Constraint"]
},
{
"category": "fruit",
"Item": {
"Text": "Banana"
},
"Type": "Value"
}],
"Types": ["Not",
"Constraint"]
},
"Type": "And"}
Here we have category fruits where We Apple,Orange ,Grapes and Guava are with "OR" and pineapple with "AND" Type and Banana is with "Not" .Once I Try
Item..Items[?(@.category='fruit')]..Text
It returns me
[ "Banana", "Apple", "Orange", "Grapes", "Guava", "Pineapple"]
But I want List to be
{["Apple", "Orange", "Grapes", "Guava", "Pineapple" ]
},{["Banana"]}
Is there a way in JSON Path to get something of similar structure