bruno
bruno copied to clipboard
Incorrect JSON response from XML body request
I have checked the following:
- [X] I use the newest version of bruno.
- [X] I've searched existing issues and found nothing related to my issue.
Describe the bug
INPUT: this xml body:
<?xml version='1.0' encoding='UTF-8'?>
<MT_Customer>
<row>
<CustomerID>DJAIMES</CustomerID>
<Country>Venezuela</Country>
</row>
<row>
<CustomerID>JJAIMES</CustomerID>
<Country>Chile</Country>
</row>
</MT_Customer>
INCORRECT RESPONSE:
{
"row": {
"CustomerID": "JJAIMES",
"Country": "Chile"
}
}
CORRECT RESPONSE MUST BE:
{
"row": {
"CustomerID": "DJAIMES",
"Country": "Venezuela"
},
"row": {
"CustomerID": "JJAIMES",
"Country": "Chile"
}
}
.bru file to reproduce the bug
meta {
name: 02-Convert_XML_to_JSON
type: http
seq: 3
}
get {
url: https://{{sap_url}}/http/convert_xml_to_json
body: xml
auth: basic
}
headers {
Content-Type: application/xml
}
auth:basic {
username: {{clientId}}
password: {{clientSecret}}
}
body:xml {
<?xml version='1.0' encoding='UTF-8'?>
<MT_Customer>
<row>
<CustomerID>DJAIMES</CustomerID>
<Country>Venezuela</Country>
</row>
<row>
<CustomerID>JJAIMES</CustomerID>
<Country>Chile</Country>
</row>
</MT_Customer>
}
Screenshots/Live demo link
The RESPONSE (file: 01_incorrect_response_bruno.jpeg) has been compared with 2 tools:
- Visual Studio Code (Rest client) - (file: 01_correct_response_VSC.jpeg)
- APIDOG (file: 01_correct_response_APIDOG.jpeg)
(I hate POSTMAN 😁)
BRUNO RESPONSE (INCORRECT response)
VISUAL STUDIO CODE RESPONSE (CORRECT response)
APIDOG RESPONSE (CORRECT response)
Bruno will automatically parse JSON in response. Because of this duplicate keys are removed.
We probably need to add a raw response viewer.