Here's the script. Beatport by &stevehero v5.0#Search Release_Joining Question.src
I was hoping to join multiple values from elements of the artist array below.
The array is like so:
"artists": [{
"id": 25274,
"name": "Luigi Daniell",
"slug": "luigi-daniell"
}, {
"id": 26182,
"name": "deadmau5",
"slug": "deadmau5"
}]
I was after the result like so from the array:
https://www.beatport.com/artist/deadmau5/26182\\https://www.beatport.com/artist/luigi-daniell/25274
I would like to combine and use a separator like the json_select_many function to output:
- https://www.beatport.com/artist/
- The
slugproperty. - A
/character. - The
idproperty.
And do this for whatever number of artist elements there are in the array like the result shown above.
Edit: I've ended up hacking a new property inside each element.
regexpreplace "(\"id\":\s+)(\d+)" "$1\"$2\"" # Fix #1 for BEATPORT_ARTIST_URL to quote the id element, IMPORTANT, DO NOT REMOVE!
regexpreplace "(\"id\": \"(\d+)\", )(\"name\": \"[^\"]+\", )(\"slug\": \"([^\"]+)\")" "\"artist_url_stevehero_custom\": \"https://www.beatport.com/artist/$5/$2\", $1$3$4" # Fix #2 for BEATPORT_ARTIST_URL to add a new element for the url, IMPORTANT, DO NOT REMOVE!
Then:
outputto "BEATPORT_ARTIST_URL"
json_select_many "artists" "artist_url_stevehero_custom" "\\u005c\\u005c"
sayrest
say "|"