# \[F\] bug with json\_foreach

**URL:** https://community.mp3tag.de/t/f-bug-with-json-foreach/16851
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [April 25, 2015, 11:25am UTC](https://community.mp3tag.de/t/f-bug-with-json-foreach/16851 "2015-04-25T11:25:46Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [May 16, 2015, 6:07pm UTC](https://community.mp3tag.de/t/f-bug-with-json-foreach/16851/4 "2015-05-16T18:07:48Z")

</div>

> [@mp3taglover](#):
>
> there is a bug with standard coverurl setting, if discogs release has multiple covers it adds ALL urls into coverurl.. (e.g. in coverurl you'll get: [http://api-img.discogs.com/....http://api-....discogs.com/](http://api-img.discogs.com/....http://api-img.discogs.com/....http://api-img.discogs.com/)... instead of just 1 URL)
> 
> ...........  
> there is no way to escape from the loop ...
> 
> maybe add a break statement for the loop? would be handy thx.

hm, I don't think this is a bug even I am a lot in favor of it. Bug is considered smth delivered not working as described. This is a missing functionality, yes.  
There are a couple of solutions Florian could apply unless he finds smth better.

1. New command **readoutputto ""** It would bring the value of tag already filled before (after **outputto ""** ) to the working area. I have requested several times this feature (which I think will increase the power of WS) but I have not seen any reaction yet. Last time requested in this post [[WS] HELP !!!](https://community.mp3tag.de/t/16672/6).

```
# Coverurl
outputto "coverurl"
json_foreach "images"
    json_select "type"
    if "secondary"
        readoutputto "coverurl" # <<<<<<<<< new code
        if "" # <<<<<<<<< new code
            json_select "uri"
            sayrest
        endif # <<<<<<<<< new code
    endif
json_foreach_end

```

2. New command **json\_foreach\_exit** (as you mentioned) It fits your example but could be insufficient for other cases. E.g. fill the tag only the first time but do not leave the loop.

```
# Coverurl
outputto "coverurl"
json_foreach "images"
    json_select "type"
    if "secondary"
        json_select "uri"
        sayrest
        json_forech_exit # <<<<<<<<< new code
    endif
json_foreach_end</li></ol>

```

---

_[View the full topic](https://community.mp3tag.de/t/f-bug-with-json-foreach/16851)._
