In this session, we’ll review JSON Parsing. Also, bring your projects and puzzlements! Everyone is welcome. Long-time Tinderbox users, new Tinderbox users, and non-Tinderbox users are very welcome to join in on the discussion.
In today’s meet, and the last problem os detecting the last list item (so as to suppress a trailing comma after the last item), list.last() is the way to go. It returns the value of the last item in the current list. If we have a line of code like:
$MyString += "},\n";
to make the comma appear except for the last item, in a loop vList where the loop variable is called ‘x’:
If ‘x’ is the value of the current list item, when on the last cycle of the .each() loop, ‘x’ and ‘vList.last’ will be the same triggering the omission of line end comma in the output.