I'm playing around with JSONata library and I'm wondering if there is any way to extend a query result similar to `...` TypeScript operator. E.g: I have the following object:
{
"input": {
"name": "John",
"email: "john@domain.com"
}
}
With the JSONata query
input
I get the following result:
{
"name": "John",
"email: "john@domain.com"
}
Now I want to add an extra field to this result such that I get something like:
{
"name": "John",
"email: "john@domain.com",
"age": 35
}
I can achieve something like this with a query like:
input.{"name": name, "email": email, "age": 35}
but I'd like to know if there is a more synthetic way of achieving the same without writing every field, something like:
input.{*, "age": 35}
Note: some sort of TypeScript equivalent would be
{
...input,
age: 35
}
but `...` operator is not available in JSONata queries. Is this even possible?
Thanks in advance for your answers/comments