Of course it depends on what else you are doing.
Far a basic example:
- Parsed the JSON you provided from the body of a HTTP request.
- Created an 'Output Data' variable to hold the updated object.
- Ran that through a Switch control to look at the value of the language property.
- If the value was 'EN' I used the
setProperty function inside a Set Variable action to set my 'Output Data' variable. You can add other country matches and have the default set the variable to the original JSON
- Returned the 'Output Data' variable as the reponse to the request.
Here's the JSON schema for the app. I used and input data variable as well as an output, but you should be able to do it with just the output variable.
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
"properties": {
"customer": {
"type": "string"
},
"email": {
"type": "string"
},
"firstname": {
"type": "string"
},
"language": {
"type": "string"
},
"lastname": {
"type": "string"
}
},
"type": "object"
}
}
}
},
"actions": {
"Input_Data": {
"runAfter": {},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Data",
"type": "Object",
"value": "@triggerBody()"
}
]
}
},
"Output_Data": {
"runAfter": {
"Input_Data": [
"Succeeded"
]
},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Output Data",
"type": "Object"
}
]
}
},
"Parse_JSON": {
"runAfter": {
"Output_Data": [
"Succeeded"
]
},
"type": "ParseJson",
"inputs": {
"content": "@variables('Data')",
"schema": {
"customer": "ABCD",
"email": "XYZ",
"firstname": "Bob",
"language": "EN",
"lastname": "Doe"
}
}
},
"Response": {
"runAfter": {
"Switch": [
"Succeeded"
]
},
"type": "Response",
"kind": "Http",
"inputs": {
"body": "@variables('Output Data')",
"statusCode": 200
}
},
"Switch": {
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"cases": {
"Case": {
"case": "EN",
"actions": {
"Set_variable": {
"runAfter": {},
"type": "SetVariable",
"inputs": {
"name": "Output Data",
"value": "@setProperty(variables('Data'), 'language', 'English')"
}
}
}
}
},
"default": {
"actions": {
"Set_variable_2": {
"runAfter": {},
"type": "SetVariable",
"inputs": {
"name": "Output Data",
"value": "@variables('Data')"
}
}
}
},
"expression": "@body('Parse_JSON')['language']",
"type": "Switch"
}
},
"outputs": {}
}