[plugin] JSON (import/export/generate/edit/inspect/...)

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Hi there,

    New version 1.2.2

    Now all the code and documentation is hosted on github

    You can download it here:

    JSON v .2.2 (2018-02-08)

    • ChangeLog

      v1.2.2 - 2018-02-08

      • Fix: Properly handle deprecated expressions
      • Fix: A debug function was being removed on export but still being called

      v1.2.1 - 2017-08-27

      • Fix: renamed the deprecated Length Expression to Size by mistake, which broke some old capx

      v1.2 - 2016-06-05

      • New Shared Reference system
      • Push and Pop Path Node into CurrentPath
      • Fix: Delete on array was setting the item to undefined without removing it, so Length and Size wasn't displaying the proper value
      • Fix: Delete and Clear in general (I was doing something stoopid)

      v1.1 - 2014-04-17

      • implement save/load/debugger
      • ToJson deprecated and replaced by AsJson for overall coherence
      • change the brackets syntax for a less confusing one (I hope)
      before: root["Wizard","stats","hp"]
      after: root@"Wizard","stats","hp"
      • change Length for Size and handle object/array return -1 for anything else
      • isEmpty condition and Clear action for array and object
      • add a CurrentValue property
      • in foreach loop reset the current path to the path given at the begining on each iteration, this way we can mess with this current path to our heart content within the loop
      • more reliable logData
    • Archive
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • really useful! thank you, Yann

  • Yup, another plug that should be "officially" supported.

    The data types are kinda weird, like learning lucids "S".


    Need a good editor now.

  • Nice!

    It might be better to have array operation like push, pop ...

  • newt

    care to explain what you mean by "the data types are kinda weird?"

    it's a direct translation of JSON's 6 basic datatypes (object, array, number, string, boolean, null)

    In the set Value action I bundle number and string together because they are the only two basic datatype you can manipulate on C2.


    Yes, but if I start implementing array functions it might make the plugin a bit too cluttered. I prefer to start with something a bit bare and see if people manage to use it well. (and if I have to make design changes it's easier )

    Also I might have to implement n00b securities like try catching attempts to access invalid path, so the exported application wouldn't crash.

    Something like

    try {
       // access some part of object that might fail with "undefined doesn't have a property called ***"
    } catch (e) {
         if (cr.in_preview()) { // don't remember the exact function
              throw e;
  • Its just that the term object is a little ambiguous, and could lead to some confusion over actual layout objects.

  • newt

    yeah, I indeed thought about that and I think that renaming "object" to something else would generate even more confusion. I could name it "dictionary" but it would lead to confusion with the dictionary plugin. And in the end, it's an JSON object so meh. The confusion, if it happens, shouldn't last too long in the mind of someone using JSON.

    Thanks for the clarification.

  • Yann , this is amazing work, will probably become my favorite plugin, so thank you, i was currently working alot with arrays, and was searching for a good system to have arrays in arrays recursively, for anything that needs a directory like structure, but a json structure is a complete solution, and is way better. (i still need to test it but it looks great)

    now if we only could use the dot notation for the created objects, something like get JSON.classes.thief.hp, + i also read recently that object variables can now be accessed by plugins, by AddObjectInstanceVarParam, im not 100% but maybe there's some possibilities in exchanging data from json to object variables

    anyway will test this in coming week..

  • Yann

    Wow, very nice. I'm hesitant to use it with my current game, but I surely could use it.

  • Smolli

    I probably won't drop support for this plugin anytime soon. But you should at least wait for people to test proof it a bit.

    As I wrote, I'm still not 100% sure about the clarity of the design. (Mostly if using the function parameters UI is a good idea or not). And I'd like the freedom to add/remove action/condition/expressions as I see fit.

    When this plugin will be referenced in the completed plugins forum, I'll insure backward compatibility (marking the thing I will want to change as deprecated) but for now, nope!



    Well, indirectly I could somehow implement some kind of dot notation using string, but it would require string parsing which would be slower. And it would looks like classes.Value(0,"Wizard.stats.hp") instead of classes.Value(0,"Wizard","stats","hp")


    Dot notation would require a very big change in how C2 editor works. Because it would have to allow uncheckable things.

    classes.Wizard.stats.hp in C2 means, for now, that your object has a behavior named Wizard which has a stats property and.... Well C2 just really can't for now.

    Also I don't think that The new AddObjectInstanceVarParam would be of any use for the JSON plugin since it's closer to the Array or Dictionary plugin. They are just data manipulation plugins, they shouldn't directly manipulate other objects.

  • Awesome!

    Any eta on some stable release? I mean, I would love to use in my current project (could make my life sooo easy) but on the other hand I don't want to find out one day that everything stopped working cause you change/remove something

    Great work!

  • shinkan

    Well, for now I didn't have any complain (not sure anyone really tested it).

    But I'd say, a safe one or two weeks would be a fair minimum

  • well i for one am currently looking into it and try to wrap my head around the plugin, but its looking good, the json file example is a good one to see how to iterate thru everything..

    questions that come to mind is,

    what will be the best way to import certain data, (maybe rex csv to ... ) or straight from a json editor

    exporting and saving the json string / edit : ok thats covered ... ToJson

    yes, it takes some time to really give good feedback or find problems, only way to know will be trying things out i guess, or wait

  • a use case i want to test, is having a list of objects, and then an array that links to an id of one of the objects to get that info

    i wonder if looping thru objects instead of properties would be a usefull

    if you have weapon(s) object, do you create a new object for each weapon or create new weapons thru properties ( thinking )

  • Yeah should have gone calling it something like keypair.

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