# \[F\] JSON parse (sub)structure

**URL:** https://community.mp3tag.de/t/f-json-parse-sub-structure/16249
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [October 21, 2014, 4:28am UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249 "2014-10-21T04:28:17Z")
**Posts on this page:** 7
**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: [October 21, 2014, 4:28am UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/1 "2014-10-21T04:28:17Z")

</div>

JSON web scripts missing functionality.  
Trying to find out how to parse a substructure. Not possible.  
E.g. "life": {"begin": 1980, "end": 2000}  
However if the structure would be a single-element array then no issue 🙂  
"life": [{"begin": 1980, "end": 2000}]  
**Florian. Help!!!!**

Edit: JSON is new so we understand the missing functionality.  
How to access json tag from another branch?  
Real example. JSON returns one structure with various header info like: current page, total pages, found items, etc.

Now I need to display current page and total pages in the release row.  
%Page% | %Pages% | %items% | %preview%  
Now the "fun" begins.

1. It is not possible to select elements of a structure. Let's say this will be available/fixed soon.
2. I am parsing a sibling of this structure, i.e. Release array. How can I access the elements of the siblings of current parent array?

I am stuck now...

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 11, 2014, 7:03pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/2 "2014-12-11T19:03:23Z")

</div>

Hi Victor,

can you point me to an example API where you experience those problems?

Kind regards  
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: [December 11, 2014, 9:20pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/3 "2014-12-11T21:20:20Z")

</div>

Hi Florian,

1. You can try this musicbrainz example: [search artist](http://www.musicbrainz.org/ws/2/artist/?fmt=json&query=artist:dire%20straits).

Trying to extract life-span begin/end values and area (country) name.

```
    "life-span": {
        "ended": true,
        "begin": "1977",
        "end": "1995"
    },

    "area": {
        "disambiguation": "",
        "iso_3166_3_codes": [],
        "sort-name": "United Kingdom",
        "name": "United Kingdom",
        "id": "8a754a16-0027-3a29-b6d7-2b40ea0481ed",
        "iso_3166_2_codes": [],
        "iso_3166_1_codes": ["GB"]
    },

```

1. Adopting official mp3tag discogs.src.  
Search by text "Sultans of Swing".

I want to "access" node "pagination" and its children for each "result" element.

Please let me know if you need additional info.  
Kind regards, Victor

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 13, 2014, 12:00pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/4 "2014-12-13T12:00:24Z")

</div>

Hi Victor,

as already discussed via PM, the new version Mp3tag v2.66 now provides dedicated functions to select complex JSON objects.

Kind regards  
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: [December 13, 2014, 4:03pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/5 "2014-12-13T16:03:13Z")

</div>

Hi Florian,

Thank you for enhancing JSON functionality. I believe JSON will be involved soon in majority of WS scripts.

1. I confirm new command **json\_select\_object** works very well except one small exception: Complex object does not exist. I apologize for not testing in depth the beta version.  
I tried **ifnot ""** to not execute nested json\_select without luck.

2. You correctly pointed to store "pagination" element in a temp tag (outputto "tmp") and then provide it to each result element (sayoutput "tmp"). That works perfectly for **[ParserScriptAlbum]=...** section but not for **[ParserScriptIndex]=...** one. Maybe I am wrong but tag commands are irrelevant to Index section.

Could you fix those small issues in the next release(s) please or I am missing some commands?

Kind regards,  
Victor

---

<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: [August 31, 2016, 6:31pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/6 "2016-08-31T18:31:12Z")

</div>

It would be nice if reported bugs (json functionality) are fixed in less time.  
It is almost **2 years** now without any feedback.  
There is no way to know **json\_select\_object** found the json object or not. Script is useless in big part of the cases.  
Try attached script with different artists (Peter Gabriel, Dire Straits, etc). Pay attention to country name column which is set to artist name in many cases.

[MusicBrainz\_\_json\_\_Artist.src](https://community.mp3tag.de/uploads/default/original/2X/5/527e0d415013b4fbff4eaafdc1174356b073c78f.src) (2.64 KB)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:07pm UTC](https://community.mp3tag.de/t/f-json-parse-sub-structure/16249/7 "2018-12-28T14:07:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
