Hi I need one help When I am using xml2js node js lib. I am able to convert the XML to JSON object however when I am iterating JSON element I can see the '$': as few of the key elements. Is there a way I can eliminate the $ key ?
Asked
Active
Viewed 252 times
0
-
Those are the attributes of a node. What do you mean by "eliminate" exactly? – charlietfl May 11 '21 at 00:58
2 Answers
0
try regex to replace the $ key
or
use JSON.parse() to replace the $.

Ashok Kumar Thangaraj
- 391
- 2
- 12
0
You can use attrkey
to change the $
key to sth else.
Or you can ignore it (do not create attribute node) with ignoreAttrs
set to true
as per the readme of xml2js

Tuan Anh Tran
- 6,807
- 6
- 37
- 54