1

I need to merge two JSON objects based on first object keys

object1 = {
 "params" : {
    "type": ["type1", "type2"],
    "requeststate": []
 }        
}

object2 = {
 "params" : {
    "type": ["type2", "type3", "type4"],
    "requeststate": ["Original", "Revised" ],
    "responsestate": ["Approved" ]
 }        
}

I need to merge two object based on first object key and my output should look like below

mergedobject = {
 "params" : {
    "type": ["type1", "type2", "type3", "type4"],
    "requeststate": ["Original", "Revised"]
 }        
}

i searched for my case and didnt find much details Please let me know is it possible to do with shell script

My case involved with morethan 15 params object and I cant declare all the param object . Also it may grow in future and I need handle that if possible.

Please comment if you need more details. Thanks for your support

Abdul
  • 942
  • 2
  • 14
  • 32

0 Answers0