grossd's Recent Forum Activity

  • all my keys are strings.

  • 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

  • Thanks.

    In the end I (nested) looped (with conditions) through all the dictionary structures and used the JSON plugin to recreate JSON. Took some time to work out.

    Would there be value to have a compatible JSON export on dictionaries and arrays?

  • Hi,

    A useful feature for my purposes would be to set the path to one "level' back.

    So, if the path is set as follows:

    JSON: Set Current Path to root@"my","path","to","an","array"

    setCurrentPath_one_back

    would set it as so:

    "my","path","to","an"

    this is very useful for when you loop though complex structures and need to "automatically" back up one step, before going down several path steps again.

    Dan

  • Hi (@Ashley),

    I have quite a bit of trouble with moving data via JSON export from Dictionaries and Arrays to other programs. I need to reparse all my structure to generate "genuine" JSON, and am still working on this code and its brittle. Its all lots of recursive structures, five levels down with an element of dynamism (some are four or three levels down, and some are five).

    It would be really great, if there was a JSON export geared for interoperability without C2s Dictionary and Array wrappers. This could then be imported straight into other programs -- such as Mathematica (where i want to do all the data visualization).

    thanks,

    Dan

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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,

    Dan

  • Perhaps you are right,

    In my case I have a following structure (All are dictionaries, and "varying game section" stats an Array, say, someone drops something X times during a game section, and i capture when (in seconds since game section start) each drop happened):

    User-Groups->Users->UserGamePlayedDate-Time>TotalGameStats->GameSectionsStats->VaryingGameSectionStats

    I need to analyze this data from various perspectives, such as improvements over time of individual users; average comparisons between user goups, etc. and graph it using charts (I am using the canvas chart plugin).

    Programming everything individually with loops can be pretty tedious. I am hoping that a map reduce implementation will make the code shorter and simpler.

    Dan

  • Rex,

    It now occurred to me that it should be pretty easy to rewrite the short MapReduce algorithm with C2. C2 has the ability to pass functions to function, as strings, and have the called. So, beside the neat packaging as a plugin, there seems no need to actually write a plugin for that. A separate event sheet should suffice.

    Dan

  • Thanks Rex,

    what I am thinking about is to create support a simple MapReduce function: https://code.google.com/p/mapreduce-js/

    With the C2 functions passed as parameters.

    I wonder if this can be done. Perhaps its already doable with your javascript function plugin

    Dan

  • I just noticed that Function is actually a plugin.

    So, it should be possible to retrieve all relevant function plugin instance data from another plugin, and thereby refer and also call functions ....

  • Hi,

    Is it possible to program a plugin so that it gets the name of a C2 function passed, and then calls that function, including passing of parameters to the function and retrieving return values?

    If so, is there documentation or examples how to do this?

    thanks,

    Dan

grossd's avatar

grossd

Member since 4 Feb, 2014

Twitter
grossd has 1 followers

Trophy Case

  • 10-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies