For input json,
{
"dataSet": {
"integerFields": {
"patient_display_id": "1",
"ehmrn": "123",
"enctrid": "456"
},
"DecimalFields": {
"class": "1",
"section": "123",
"enctrid": "456"
}
}
}
I want to delete integerFields but keep the value of it, an output something like this. But keep rest of the fields intact
{
"dataSet": {
"patient_display_id": "1",
"ehmrn": "123",
"enctrid": "456",
"DecimalFields": {
"class": "1",
"section": "123",
"enctrid": "456"
}
}
}
2
Answers
If you just assign it’s value to the key containing it, it will be overwritten
Merge the keys of the
integerFields
dictionary with thedataSet
dictionary, then delete theintegerFields
key:Output: