Converting from XML to JSON

I’m new to Postman & API’s and wondering if anybody understands why
this XML file

Ends up like this:

I suspect schema, but when I try to import the schema, it fails.

Hi @simens65

When you say “Ends up like this:”… what is happening between image 1 and image 2?

Do you submit a GET/POST call, is it custom code, or importing files? etc.

Hi Pic 1 is the body I read as input

This is the test script:
image

Pic 2 is the result I get.

I don’t understand why the $ sign appears and even stranger it gets further down.
As this shows, the value and parameter name has switched…
image

I haven’t done much with XML in Postman, but maybe this will help… ?

According to the NPM page, there is a prefix option.

Some additional info that seems related…

It’s kinda late for this response, but…

  • ‘$’ is a pseudo-object to capture attributes
  • postman xml2Json is not the same as nodejs equivalent … the only argument is the xml string, so you just have to use the ‘$’ key if you want to extract any attribute values.