I need to transform a JSON, which can either have 1 value or 2. So it can be:
{"form":{"textinput1":"aaa"},"params":{"context":""}}
or
{"form":{"textinput1":"aaa"},"params":{"context": "something"}}
And the output I need is this:
{"input": {"text": "aaa"}}
or
{"input": {"text": "aaa"},"context": "something"}}
JQ Transform would be:
{"input": {"text": .form.textinput1}}
or
{"input": {"text": .form.textinput1},"context":.params.context}
But how to merge these two into a condition?