# XML to JSON

**URL:** https://community.mp3tag.de/t/xml-to-json/16299
**Category:** Web Sources Discussion
**Created:** [November 7, 2014, 5:57pm UTC](https://community.mp3tag.de/t/xml-to-json/16299 "2014-11-07T17:57:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 7, 2014, 5:57pm UTC](https://community.mp3tag.de/t/xml-to-json/16299/1 "2014-11-07T17:57:57Z")

</div>

JSON is the first mp3tag proper WSS parser.  
I managed to convert XML to JSON by only using regular expressions.  
It covers all complex structures, attributes, comments, CDATA, namespaces.  
And yes, it is written from scratch.  
One thing convertor cannot know is if XML tags with single appearance are subject to array.

```
<disc number="1">
<track number="1">Innuendo</track>
<track number="2">One vision</track>
</disc>

```

Both disc and track are array elements but only track appears multiple times.  
There is a solution for this:

1. Convert everything to array
2. Pass the script the list of array tags

XML to JSON conversion cannot be used yet - JSON mode parses only the original stream - but hopefully it will be soon available (Florian, I am patient :wink:).

I attach two pairs of XML-JSON files (pretty printer applied to all 4 files in notepad++).

[Queen\_Platinum\_Collection.xml](https://community.mp3tag.de/uploads/default/original/2X/a/af06ac79622f2d2e989fef89d53a429d1bf1b6ac.xml) (9.73 KB)

[Pink\_Floyd\_Discovery.xml](https://community.mp3tag.de/uploads/default/original/2X/0/0661dbadcd33147d073a0229ba74920f5bc1d5e0.xml) (30 KB)

[Queen\_Platinum\_Collection.json.txt](https://community.mp3tag.de/uploads/default/original/2X/a/ae00eca0e677f5df6458a3178e85210af8f5bd12.txt) (14.4 KB)

[Pink\_Floyd\_Discovery.json.txt](https://community.mp3tag.de/uploads/default/original/2X/8/80d42736cb2b0b10c75ffad1e882771e50f27316.txt) (50.9 KB)

---

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 8, 2015, 12:45pm UTC](https://community.mp3tag.de/t/xml-to-json/16299/2 "2015-11-08T12:45:14Z")

</div>

QUOTE (Victor Kostas @ Nov 7 2014, 19:57) \<{POST\_SNAPBACK}\>

JSON is the first mp3tag proper WSS parser.

I managed to convert XML to JSON by only using regular expressions.  
It covers all complex structures, attributes, comments, CDATA, namespaces.  
And yes, it is written from scratch.  
One thing converter cannot know is if XML tags with single appearance are subject to array.

```
<disc number="1">
<track number="1">Innuendo</track>
<track number="2">One vision</track>
</disc>

```

Both disc and track are array elements but only track appears multiple times.  
There is a solution for this:

1. Convert everything to array
2. Pass the script the list of array tags

XML to JSON conversion cannot be used yet - JSON mode parses only the original stream - but hopefully it will be soon available (Florian, I am patient :wink:).

I attach two pairs of XML-JSON files (pretty printer applied to all 4 files in notepad++).

  
Is it that difficult to implement this request? Use current stream when switching to **JSON** mode.  
XML stream is converted to JSON but command **JSON "on"** parses the original (xml) stream.  
It looks simple change but either forum emails do not reach or touch Florian....

---

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 24, 2015, 5:32pm UTC](https://community.mp3tag.de/t/xml-to-json/16299/3 "2015-11-24T17:32:18Z")

</div>

It's really a pity I have spent a huge effort to convert XML to JSON and it cannot be used in WS. ![:wacko:](https://community.mp3tag.de/uploads/default/original/1X/455ecca54df2b24f3c99cde256604242b1031da2.gif ":wacko:")

---

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [February 7, 2016, 7:34pm UTC](https://community.mp3tag.de/t/xml-to-json/16299/4 "2016-02-07T19:34:09Z")

</div>

JSON "ON" should parse the current stream. Now it does always parse the original.2  
Is it difficult to implement this feature? Waiting 18 months now!!!!!!!!!!!!!!!!
