MM5 producing invalid JSON file?

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: MM5 producing invalid JSON file?

Re: MM5 producing invalid JSON file?

by PetrCBR » Fri Apr 20, 2018 3:33 am

Will be fixed in next build.

Re: MM5 producing invalid JSON file?

by PetrCBR » Thu Apr 19, 2018 11:22 am

Hi Barry.

I will check that.

MM5 producing invalid JSON file?

by Barry4679 » Wed Apr 18, 2018 10:41 am

I am trying to process a JSON file produced by MM5. MM5 generates the JSON using a code sample provided by PetrCBR is this thread; http://www.mediamonkey.com/forum/viewto ... 15#p443235

Code: Select all

Dim SDB : Set SDB = CreateObject("SongsDB5.SDBApplication")
Dim SLText : SLText = SDB.runJSCode("(function() { app.playlists.getByIDAsync(3).then(function(playlist) { playlist.getTracklist().whenLoaded().then(function (list) { runJSCode_callback(list.asJSON); }); }); })()", True)
Dim SL : Set SL = SDB.fromJSON(SLText)
I am using Python and cannot load the JSON file. If I understand this StackOverflow thread correctly, it seems to be a MM5 rather than Python issue.
https://stackoverflow.com/questions/197 ... json-files

they quote from here: http://www.ecma-international.org/publi ... MA-404.pdf
Insignificant whitespace is allowed before or after any token. The whitespace characters are: character tabulation (U+0009), line feed (U+000A), carriage return (U+000D), and space (U+0020). Whitespace is not allowed within any token, except that space is allowed in strings
The problems are due to un-escaped tab characters, in the MM5 JSON file of MM5 playlist contents, from a few tracks in my MM database.

The first problem was from the the album An Awesome Wave by the band alt-J ... several tracks had path names which began with a tab character ... the three tracks beginning with a "(" if anyone has the album.
eg: this was what the path for one of the tracks looked like:
https://www.dropbox.com/s/8s13hcr0bo32y ... 1.png?dl=0

The other problem was caused by the album Psyence Fiction by the band UNKLE ... the title tag of the track "Guns Blazing (Drums of Death, part 1)" begun with a tab character ... you can't see it in MM4, but you can in MM5
https://www.dropbox.com/s/how1bravwmppc ... 2.png?dl=0

All tracks operate OK in MM4 & MM5, but should MM5 be escaping these characters before generating the JSON file, so that it meets the JSON spec?

If I remove these tracks from my MM5 library, the JSON file produced by PetrCBR's code works as expected.

Top