Spaces:
Sleeping
Sleeping
File size: 341 Bytes
68f7925 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
export function parseToJSON(xmlString: string) {
const attributes = xmlString.match(/(\w+)='([^']*)'/g);
const jsonObject: Record<string, string> = {};
if (attributes) {
attributes.forEach((attr) => {
const [key, value] = attr.split('=');
jsonObject[key] = value.replace(/'/g, '');
});
}
return jsonObject;
}
|