I did not check the JSON code.
It seems that you describe a problem with a comma separated list, and with a trailing comma at end of the list.
There might be more than one possible solutions.
One is, do not write a trailing comma after each array object, but write a leading comma before each following array object, starting from object #2.
For the very first array object, suppress the leading comma.
Example:
01: $filename($getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt',UTF-8)02: $loop(%_filename_ext%)$ifgreater(%_counter%,1,',',)'{'
03: '"trackNumber":"'$num(%TRACK%,2)'",'
04: '"title":"'%TITLE%'",'
05: '"artists":"'%ARTIST%'",'
06: '"composers":"'%COMPOSER%'",'
07: '"length":"'%_length%'",'
08: '"bitRate":"'[%_bitrate%'kbps'[' '%_vbr%]]'",'
09: '"fileName":"'%_filename_ext%'",'
10: '"fileSize":"'%_file_size%'"'
11: '}'$loopend()
DD.20150202.0928.CET, DD.20150202.1211.CET
See also ... the other way round ... a slightly other problem ...
"Determine the last loop"
... which needs a little bit more coding ... my proposal from there ...
Determine the last loop inside loop?
DD.20150203.0913.CET