Dictionary exported JSON not recognized by JSON parsers

0 favourites
  • 8 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi,

    I explorted into a text file a recursive JSON string I got from a dictionary which includes JSON strings as value. However, JSON parsers have trouble parsing the JSON, including the Mathematica JSON import parser -- sometimes only the first key is recognized, and Mathematica seems to view the whole JSON file as one big string.

    any thoughts on that would be appreciated,


  • C2 uses wraped json data and only imports wrapped json data. It's really annoying. So c2 can't share. You should try yann's json plugin

  • I have no problem loading regular JSON with the AJAX loader and the JSON I get from the C2 Dictionary and Array objects load up just fine with Newtonsoft... including nested JSON strings. I have also ran the C2 JSON through JSONLint and it looks fine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks ggibson1

    Reloading into C2 works very well for me too. Just when I try to load the JSON into mathematica with Import, the nested JSON isn't recognized as an association, but as a string.

    Testing with a number of other JSON parsers, I get similar results.

    Perhaps some JSON parsers are more robust to unusual input than others ...

    p.s. BTW, i just ran my nested JSON through Lint and it only recognizses the top level keys.

  • Perhaps your nested JSON actually is just a string? It isn't really nested JSON unless it is JSON nodes ... JSON nodes encoded into a string isn't nested JSON.

  • Thanks.

    Its like this:

    UserSession.addKey(gameMetric_n, m)

    UserSessions.addKey(Date1, UserSession.asJson)

    AllUsersSessions.addKey(userName, UserSessions.asJson)

    and a few more like these nested within UserSession

    In the end i stored AllUsersSessions.asjson into a text file.

    So, the total outcome appears like nested wrapped C2 Json

  • I am not sure that's what you're referring to, but i had a problem with adding keys with global numbers as keys without stringing them first, they were just not added to dictionary.

    Do you see all the data in the dictionary UserSession in debug mode, before you're saving it?

  • all my keys are strings.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)