When calling a REST API service with a JSON payload from Logic Apps, Logic Apps reorders JSON elements alphabetically, while some services expects the elements to be in a fixed order causing the service call to fail with an error.
This behavior happens when constructing the JSON payload inside a compose action or the HTTP action body field; after save, the elements are automatically reordered alphabetically.
The standard definition of a JSON object is:
An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.
A service expects the following JSON object:
"Name": "XXX XXXX",
Logic Apps reorder the elements of the JSON object to become as follows:
"Name": "XXX XXXX"
To workaround this, please use the following steps:
Use Variables – initialize variable action to initialize a string variable setting the value to the JSON object string.
Use the initialized variable as the body for the HTTP action calling the service.