Tinderbox Meetup SATURDAY 2 NOV 24: A Review of JSON Parsing

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.

SUNDAY, 2 November 2024


Timing

9 AM Pacific Time

Noon Eastern time

1300 São Paulo

1600 UTC

1700 London

1800 Paris

2130 Delhi


Join Details

Zoom Meeting

Meeting ID: 617 924 9044

Passcode: tinderbox

For more details and to join the conversation with the Tinderbox community, visit the Tinderbox Forum. Tinderbox Meetup Calendar.

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’:

vList.each(x){
   // code
   if(x == vList.last)
      $MyString += "}\n";
   }else{
      $MyString += "},\n";
   };
   // more code
};

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.

1 Like