How to add additional fields to an existing non-empty json object ? #240
GokulK-123
started this conversation in
General
Replies: 1 comment
-
|
The easiest way is to simply plus the two objects together: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to write a function using JSLT that receives a non-empty json object, obj1, as one of the function parameter. I need to add a couple of fields to it and return it back to the caller. But this doesn't seem to be working. How can I add additional fields to an existing non-empty json object and return it back ?
def func1 (obj1, resp){
obj1.prop1 = resp.prop1
obj1.prop2 = resp.prop2
$obj1
}
def main(){
"data": func1(obj1,resp)
}
Beta Was this translation helpful? Give feedback.
All reactions