HTTP Request Body JSON Array is converted to JSON Object with index as keys
See original GitHub issueI am trying to hit a backend REST API (Method: PATCH) that accepts the following JSON array as body:
[
{
"op": "replace",
"path": "/dueDate",
"value": "${user.control_assignment_due_date}"
}
]
However, when I view the emulator’s trace, I see that the body is transformed into a JSON object like below, which is not accepted by our backend service.
content:"{"0":{"op":"replace","path":"/dueDate","value":"12/31/2021"}}"
I am facing the same issue with yet another POST API where I need to send a JSON array as body.
Please help me in resolving this issue.
About my Bot Framework Composer: Version: 2.0.0 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Converting an Array to a JSON Object in JavaScript
To get a JSON object from an array with index keys you can use the Object. assign method in conjunction with JSON. stringify...
Read more >Convert array to JSON - javascript
Using JSON.stringify() , we convert the JavaScript array to Json string. And using JSON.parse() , we convert Json string to a Json object....
Read more >Converting an Array to JSON Object in JavaScript
To get a JSON object from an array with index keys you can use the Object.assign method in conjunction with `JSON.stringify` following code:...
Read more >Convert JSON Request Body to JAVA Object
This article explains How to Convert JSON to JAVA Object using Seriallization with example and How to serialize request body into POJO?
Read more >JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let me try that. However, I was able to get rid of the issue, just a while ago, by selecting string and just specifying the array directly. Please see below.
Since we have a functional workaround, I am going to go ahead and close this issue. If you have further difficulties regarding this item, please comment and we can reopen it.