appmixer.utils.xml.XmlToJson
1.0.0
Public
| Field | Type | Description |
|---|---|---|
| XML | textarea | XML text content to convert to JSON. |
| Allow Boolean Attributes | toggle | To allow attributes without value. <root checked></root> -> { "root": { "@checked": true } } |
| Always Create Text Node | toggle | Instead of creating a property with the tag name and assign the value directly, create a #text node with the value. <root>foo</root> -> { "root": { "#text": foo } } |
| Attributes Group Name | text | To group all the attributes of a tag under given property name. E.g. for "_@": <root a=foo b=bar></root> -> { "root": { "_@": { "a": "foo", "b": "bar" } } } |
| Attribute Name Prefix | text | To recognize attributes in JSON separately. E.g. for "_@": <root a=foo><a>wow</a></root> -> { "root": { "a": "wow", "_@": "foo" } } |
| CDATA Property Name | text | If not set to some property name, then CDATA values are merged to tag's text value. E.g. for "$cdata": <name>name:<![CDATA[<some>Jack</some>]]><![CDATA[Jack]]></name> -> { "name": { "$cdata": ["<some>Jack</some>", "Jack"], "#text": "name:" } } |
| Comment Property Name | text | If set to some property name, then comments are parsed from XML. E.g. for "$comment": <root><!-- mycomment --></root> -> { "root": { "$comment": "mycomment" } } |
| Ignore Attributes | toggle | Ignore attributes. By default, attributes are not ignored and have the "@" prefix. |
| Ignore Declaration | toggle | Ignore declaration. E.g. for true, <?xml version="1.0"?><?elementnames <fred>, <bert>, <harry> ?><h1></h1> -> { "?elementnames": "", "h1": "" } |
| Ignore PI Tags | toggle | Ignore PI tags. E.g. for true, <?xml version="1.0"?><?elementnames <fred>, <bert>, <harry> ?><h1></h1> -> { "h1": "" } |
| Always Array | text | Comma separated list of JSON paths to tags that will be always parsed as array. By default, single tags are parsed as objects. E.g. for "root.b", <root><b>foo</b></root> -> { "root": { "b": ["foo"] } } |
| Parse Number Leading Zeros | toggle | When number with leading zeros like 08 should be parsed. 0.0 is not impacted. E.g. for true: "-06" -> -6, for false: "-06" -> "-06" |
| Parse Hex Numbers | toggle | Set to false to skip parsing hex numbers. E.g. for true: "0x2f" -> 47, for false: "0x2f" -> "0x2f" |
| Skip Parse Number RegExp | text | Skip parsing numbers matching regular expression. E.g. for /+[0-9]{10}/: "+1212121212" -> "+1212121212", for false: "+1212121212" -> 1212121212 |
| Parse Attribute Value | toggle | Parse attributes value. E.g. for true, <root enabled=true></root> -> { "root": { "@enabled": true } }; false would give { "root": { "@enabled": "true" } } |
| Parse Tag Value | toggle | Parse tags value. E.g. for true, <root>33</root> -> { "root": 33 }; false would give { "root": "33" } |
| Preserve Order | toggle | Preserve order. |
| Process Entities | toggle | Process default and DOCTYPE entites. |
| Remove Namespace Prefix | toggle | Remove namespace string from tag and attribute names. |
| Stop Nodes | text | Comma separated list of JSON paths to tags that will be skipped from processing. You can also mention a tag which should not be processed irrespective of their path by prefixing with "*.". E.g. for "root.a", "*.pre", <root><a>foo<c>bar</c></a><pre><b>baz</b></pre></root> -> { "root": { "a": ["foo", "<c>bar</c>"], "pre": "<b>baz</b>" } } |
| Text Node Name | text | Text value of a tag is parsed to #text property by default. You can provide a different property name, e.g. "$text". |
| Trim Values | toggle | Remove surrounding whitespace from tag or attribute value. |
| Unpaired Tags | text | Unpaired Tags are the tags which don't have a matching closing tag. Eg <br> in HTML. Parse unpaired tags by providing their comma separated list. |
| Field | Type | Description |
|---|---|---|
| JSON | - |