Open bhavaniravi opened 7 months ago
I have been constructing a JSONata query and it involves multi-level json operation. Transforming and filtering. This is my 1st attempt.
{ "id": <path>.value, "source_id": <path>.value, "type": <path>.value, "inner_list": <path>.[filter!=null].{ "index": <path>.value, "text": <path>.value, "responses": <path>.{ "index": <path>.value "original_response": <path.value> } } }[$count(inner_list) != 0]
count(inner_list)
... ... }[$count(inner_list) != 0]{ "id": source_id ? id : null, "type": type in ["preamble_9", "preamble_10", "preamble_11"] ? "Default Preamble" : type, <how-to-preserve-all-the-other-keys-here> }
How to preserve/unpack the keys that are untouched?
Note: We will be generating jsonata programatically, so re-writing the whole object again isn't an option
I have been constructing a JSONata query and it involves multi-level json operation. Transforming and filtering. This is my 1st attempt.
Things I want to do
count(inner_list)
as a key/value in the objectHow to preserve/unpack the keys that are untouched?