Json question ifnot

What is the proper way to(an array), if as nothing, it doesnt count? i mean if it as something do one thing, if as nothing do another.

arrangers []

i made this but if array as nothing dont work.

 >  # Arrangers
> outputto "CONDUCTOR"
> json_foreach "arrangers"
> ifnot ""
> 	json_select "names"
> 	json_select "en"
>  	sayrest
>   else
> 	say ""
> 	sayrest
>   endif
> 	say ", "
> json_foreach_end

Anyone? @dano @stevehero @Florian

Maybe its a noob question but i want to learn

Not fully sure what you mean, do you want to know the length of the array and if 0 do something, else do another thing?

Here's the code I use for [ParserScriptIndex]=...

json_foreach "remixers" # REMIXERS COUNT
ifnot "0"
say "-"

I meant if it as no value/nothing do one thing, and if it as data do Another,
Because if i use (the code above) that array and it as nothing it gives an error, and not if it as Something.

apear something else in conductor:

or if the album as arranjers(conductor):
is ok


say ""

Not be:

say ""

Nope, it gives same error.

Try take out also.

say ", "

Thats not it, because the
ifnot ""

its not working as it gets in the "Conductor" tag the next array that matches, if the arrangers have nothing:

Without the full script to test it's hard to troubleshoot. @Florian might have better success.

VGMdb#Search by &Album JSON.src (3.5 KB)

What release gives the error?

everyone that dont have something in the arrangers array, per example:

Planescape Torment: Enhanced Edition Official Soundtrack


You need ifnot "0" instead of ifnot ""

1 Like

A simple thing like that, thank you @dano and @stevehero it worked, it opens a lot for me. It was driving me crazy.

1 Like

I thought you might of tried the ifnot "0" of the code example in my first reply. It'll check the array length.

The index starts at zero and not one. Few languages use 1 as the first index.

Good you got it sorted.