How to extract Attributes? #642
Unanswered
leviskim17
asked this question in
Q&A
Replies: 1 comment
-
If you want to try experimental changes for v5, you can use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here is my test code.
import {XMLParser} from 'fast-xml-parser';
const xmlDataStr =
<root a="nice" enabled="true" int="32"><a>wow</a></root>
;var options = {
ignoreAttributes : false,
parseAttributeValue : true,
};
const parser = new XMLParser();
const jsonObj = parser.parse(xmlDataStr, options);
console.log(JSON.stringify(jsonObj, null, 2));
But the return cannot extract attributes.
`{
"root": {
"a": "wow"
}
}`
Somebody has any idea? Thank u!
Beta Was this translation helpful? Give feedback.
All reactions