Hi Monika,

It can be tough in lists to know when you've reached the last item.  It's 
usually easier to know when you're on the first one, so I'd suggest looking 
at it the other way around:
Include a comma at the start of every item, except for the first one.

You're already using a pre-execute block mark, so all you need to do is 
introduce a counter.  Set it to 1 before you start your list; check its 
value at the start of your collection and only output the comma if the 
value is greater than 1.  Oh - and don't forget to increment it each time 
as well  :)

I haven't tested it, but something like this:


<!IoRangePreExecute><% counter = 1 %><!/IoRangePreExecute>
{"Image": [<!IoRangeList><!IoRangeRedDotMode><!--<%lst_plSW%>--><
!/IoRangeRedDotMode><!IoRangePreExecute><% if "<%std_url%>" <> ""  then %>
<!IoRangePreExecute><% if counter > 1 then %>,<% end if %><
!/IoRangePreExecute>
 {         "YouTube-Titel": "<%hdl_ueberschrift%>",
          "Hersteller": "<%!! 
Context:Pages.GetPage(Guid:<%inf_pageGuid%>).MainLink.OwnerPage.Headline 
!!%>",
          "Kategorie": "<%ol_videoTyp%>",
          "URL": "<%std_url%>"
     }
<% counter = counter + 1 %>
<% end if %><!/IoRangePreExecute><!/IoRangeList>
]}


Good luck,
Mark


On Saturday, 18 July 2015 14:41:21 UTC+1, Monika Beste wrote:
>
> Hi All,
>
> I created a json-Template that displays all needed entries of my list, but 
> the last comma at the end of the list causes a Parse error in the 
> json-validator (Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', 
> '[').
>
> {"Image": [<!IoRangeList><!IoRangeRedDotMode><!--<%lst_plSW%>--><
> !/IoRangeRedDotMode><!IoRangePreExecute><% if "<%std_url%>" <> ""  then %>
> {         "YouTube-Titel": "<%hdl_ueberschrift%>",
>           "Hersteller": "<%!! 
> Context:Pages.GetPage(Guid:<%inf_pageGuid%>).MainLink.OwnerPage.Headline 
> !!%>",
>           "Kategorie": "<%ol_videoTyp%>",
>           "URL": "<%std_url%>"
>      },    <% end if %><!/IoRangePreExecute><!/IoRangeList>
> ]}
>
>
> Can someone please tell me how to eliminate the last comma? 
>
>
> Thanks,
> Monika
>

-- 
You received this message because you are subscribed to the Google Groups 
"RedDot CMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reddot-cms-users+unsubscr...@googlegroups.com.
To post to this group, send email to reddot-cms-users@googlegroups.com.
Visit this group at http://groups.google.com/group/reddot-cms-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to