cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

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

ppankaj88
New Contributor

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 3

Supratim
Contributor III

@ppankaj88 Try this binary to document snap then replace(/[@]/g, โ€˜โ€™) .with content

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

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