# Suggestion: including a hierarchical list of parent objects in json\_select

**URL:** https://community.mp3tag.de/t/suggestion-including-a-hierarchical-list-of-parent-objects-in-json-select/71967
**Category:** Web Sources Discussion
**Created:** [October 15, 2026, 9:52am UTC](https://community.mp3tag.de/t/suggestion-including-a-hierarchical-list-of-parent-objects-in-json-select/71967 "2026-10-15T09:52:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yorickausyps](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yorickausyps](https://community.mp3tag.de/u/yorickausyps)
#### Post date: [October 15, 2026, 9:52am UTC](https://community.mp3tag.de/t/suggestion-including-a-hierarchical-list-of-parent-objects-in-json-select/71967/1 "2026-10-15T09:52:27Z")

</div>

In json web sources a json element often resides several object levels below the current level. To reach such a deeply nested element and read its value, many lines of code are needed. This process even gets more complex, if it's not sure, whether all the intermediate object levels exist or if the chain stops at some point.  
Therefore I came up with the following code for reading a value that is e.g. two levels below the current object level, and that is robust and fail save against the hierarchy possibly ending at an intermediate level.

```auto
	json_select_object "links"
	ifnot ""
		json_select_object "target"
		ifnot ""
			json_select "href"
			json_unselect_object
		endif
		json_unselect_object
	endif

```

With an extended `json_select` command that supports the specification of a variable number of parent object names in addition to the elements name to be read, e.g.

```auto
json_select "parent1" "parent2 "more parents" "object"

```

the above script would then need only one line:

```auto
	json_select "links" "target" "href"

```

This extended command should

- support a variable number of hierarchical parent levels, probably limited up to 10.
- give nothing back, if any of the parents or the element itself does not exist or if the element has no value, otherwise it returns the elements value.
- in any case stay at the current object level.

In my use case I only have two hierarchical object levels, but e.g. in the script [[WS] iTunes source script with multiple search criteria](https://community.mp3tag.de/t/ws-itunes-source-script-with-multiple-search-criteria/47197) by @rboss you can find up to four levels.  
In my opinion this new feature would greatly simplyfy coding, make scripts more robust and failsave against changes on the web source server side and probably increase execution speed of scripts.
