# Json question ifnot

**URL:** <https://community.mp3tag.de/t/json-question-ifnot/49912>\
**Category:** Web Sources Discussion\
**Created:** [August 15, 2020, 2:43pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912 "2020-08-15T14:43:47Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 15, 2020, 2:43pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/1 "2020-08-15T14:43:47Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 21, 2020, 12:21pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/2 "2020-08-21T12:21:04Z")

</div>

Anyone? @dano @stevehero @Florian

Maybe its a noob question but i want to learn

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 21, 2020, 12:49pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/3 "2020-08-21T12:49:35Z")

</div>

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]=...`

```auto
json_foreach "remixers" # REMIXERS COUNT
ifnot "0"
sayrest
else
say "-"
endif
json_foreach_end

```

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 21, 2020, 1:08pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/4 "2020-08-21T13:08:28Z")

</div>

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.

[![](https://community.mp3tag.de/uploads/default/original/2X/6/6275180b2531811e77b3cad5e1ac621f51591dfb.png) ](https://i.imgur.com/dl9Km7g.png)

apear something else in conductor:  
 ![](https://community.mp3tag.de/uploads/default/original/2X/4/40849ae332b2154d74b153cbe0cdc781105e90d9.png)

or if the album as arranjers(conductor):  
is ok  
 ![](https://community.mp3tag.de/uploads/default/original/2X/0/066d18355cb36a9bcdf060242614538c47bb5f42.png)

[![](https://community.mp3tag.de/uploads/default/original/2X/f/fa969cb620894af1cae4ee8fd3169ff7c5a41e82.png) ](https://i.imgur.com/0jiA1nF.png)

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 22, 2020, 6:41am UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/5 "2020-08-22T06:41:24Z")

</div>

Should:

```auto
say ""
sayrest

```

Not be:

```auto
say ""

```

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 22, 2020, 7:44am UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/6 "2020-08-22T07:44:25Z")

</div>

Nope, it gives same error.

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 22, 2020, 10:42am UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/7 "2020-08-22T10:42:51Z")

</div>

Try take out also.

```auto
say ", "

```

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 22, 2020, 1:46pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/8 "2020-08-22T13:46:55Z")

</div>

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:

![](https://community.mp3tag.de/uploads/default/original/2X/3/385b4b50e1deedeb674cbffb71f343fa5c145f1f.png)

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 22, 2020, 2:57pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/9 "2020-08-22T14:57:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 22, 2020, 3:43pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/10 "2020-08-22T15:43:11Z")

</div>

[VGMdb#Search by &Album JSON.src](https://community.mp3tag.de/uploads/short-url/7DtlFn1Z1EcViVgOgSriaZLLAKX.src) (3.5 KB)

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 22, 2020, 3:59pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/11 "2020-08-22T15:59:36Z")

</div>

What release gives the error?

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 22, 2020, 4:01pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/12 "2020-08-22T16:01:56Z")

</div>

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

Planescape Torment: Enhanced Edition Official Soundtrack

[http://vgmdb.info/album/73784](http://vgmdb.info/album/73784)

---

<div class="post-metadata">

**Author:** ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)\
**Post date:** [August 22, 2020, 6:07pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/13 "2020-08-22T18:07:53Z")

</div>

You need ` ifnot "0"` instead of `ifnot ""`

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [August 22, 2020, 6:22pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/14 "2020-08-22T18:22:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [August 22, 2020, 7:29pm UTC](https://community.mp3tag.de/t/json-question-ifnot/49912/15 "2020-08-22T19:29:37Z")

</div>

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.
