question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTP Request Body JSON Array is converted to JSON Object with index as keys

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
RamkumarManavalancommented, Jan 3, 2022

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. Screenshot 2022-01-04 at 12 01 55 AM

0reactions
anishprasad01commented, Jan 3, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found