Hello everyone,
Here's a simple problem, but one I can't find a solution for:
From this array
{
"genre": [
"Hip-Hop/Rap",
"Music",
"Hip-Hop",
"Hardcore Rap"
]
}
How can I extract all genre values?
Ideally, the correct command to use would be json_select_many "array" "object" s s n n, but since there is no key on each value, what would make sense would be json_select_many "array" "" s s n n. But this doesn't work; or rather, returns [empty]
I've also tried
(...)
json_foreach "genre"
OutputTo "integer"
json_foreach_counter
json_select_array "genre" "%integer%"
OutputTo "testOutput"
SayRest
Set "%integer%"
json_foreach_end
This should assign 1~4 to %integer% and then use json_select_array "genre" "1~4" to get the values; but this returns an error on json_select_array "genre" "%integer%" because %integer% is interpreted as a string and not as a number, which breaks the command.
This test data is a valid JSON array, as per validation by jsonlint.com.
So what am I missing?
Thank you in advance.