How to prevent duplicate tags in Websources Script?

I am facing the following problem in a Websources Script:

When I loop through a JSON result file with this code snippet

OutputTo "SOLOIST"          # A Solo artist can play the same instrument on different days
json_select "artist"        # therefore he/she appears multiple times on a MusicBrainz recording
json_foreach "artist"
   json_select "name"
      SayRest
json_foreach_end

the content for the SOLOIST-per-recording in the Websource script looks like this:

|Isaac Stern\\Alexander Zakin\\Isaac Stern\\Alexander Zakin\\

As you can see, the artists are doubled in this case. As soon as applied, this creates 4 SOLOIST tags
SOLOIST Isaac Stern
SOLOIST Alexander Zakin
SOLOIST Isaac Stern
SOLOIST Alexander Zakin
This is an example. A Solo artist could appear many more times and in random sort order.

Do you know a Webscript way to prevent writing such identical information into tags?

The de-duplicated content should look like this for the above case, showing every Solo artist only once:
SOLOIST Isaac Stern
SOLOIST Alexander Zakin

With this regular expression (used in a Mp3tag Action, after using the Webscript)
$regexp($meta_sep(SOLOIST,\\),'(\b\w+\b),? ?-? ?(?=.*\1)',)
we can eliminate the duplicate artists afterwards.
But I would rather detect it already in the source script and prefer not to write into the tracks at all.

Any idea how to do that?