Forum Discussion

ppankaj88's avatar
ppankaj88
New Contributor II
5 years ago

Replace "@" and "#" while converting XML to JSON

Hi All,

I am converting XML file to JSON file using XML parser snap and JSON formatter.

When I’m converting, prefix “@” is getting added to all the attributes. For example:-

In XML → “ProviderPaxRef”: “String”
In Converted JSON → “@ProviderPaxRef”: “String”

Now I wanted to remove prefix “@” from every element dynamically. Can anyone help me on this.

Regards,
Pankaj

3 Replies

    • ppankaj88's avatar
      ppankaj88
      New Contributor II

      Replace function is not working, could you please share an example.

      • Supratim's avatar
        Supratim
        Contributor III

        After using doc to binary snap(make decoding as none) take one mapper and use
        $content.replace(/[@]/g, ‘’)