Repository navigation
How to extract Attributes? #642
Replies: 2 comments
|
If you want to try experimental changes for v5, you can use |
0 replies
|
Please check @nodable/flexible-xml-parser once |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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!
All reactions