[Beta] JSON Object

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Thanks to Phi and ConceptGame for helping to debug this extension.

    JSON object currently can read JSON files from strings using James' json-parser library that comes with the EDIF SDK. This library only supports reading JSONs, not modifying or creating JSONs, so for that I will have to redesign somewhat.

    The lastest version of the extension will always be at this URL: Please login to see this link.

    Please test the object and make sure it works correctly and report any issues here. Make note of the version number in the extension properties.

    Enjoy :)

    Working as fast as I can on Fusion 3

  • Finally extension is debuggued.
    So.. I was a good job to come back to the front this topic (Please login to see this link.) forgotten in the matrix of Clickteam forums :)
    Also, thanks for all help Phi and conceptgame, and for sure to LB for making dream live true!

    I don't have the time to check it from now, but I will do later for sure :)

    Hey I'm French, Hi!

    MMF2 SoundScape Engine (Moteur d'environnement) :
    FR: Please login to see this link.
    EN: Please login to see this link.

    May the .NET be with you (Star Wars .NET©)

  • LB, I'm trying your beta json object.
    I have a json string like this :


    The thing is I need in a loop to get every stringvalue$ of an object -
    If have correctly understood (I don't know how to do this differently), in order to get return each stringvalue$, I have to do this :

    Code
    Go to Root
    Enter Object named ("elem"+loopindex)
    Enter Array index (0)
    Enter Object name("uid")
    Go to Root
    Enter Object named ("elem"+loopindex)
    Enter Array index (0)
    Enter Object name("id")
    ....


    I'm just wondering why have I to set each time Go to Root, Enter Object named and array index....???
    Because I'm just finally stucked since I'm blocked with the 127 limit actions because of these repeated lines of action...

    Did I do something wrong ? or is just how your plugin working ? If so, do you think you can do something about this ?

    Hopefully my english is clear, it's the end of my working day!
    Thanks for your time!

  • Yes, that is what you have to do, but I don't understand why you are trying to hard-code the loop instead of dynamically processing them? Also, if you can, you may want to change your JSON structure to something easier to work with - for instance I don't understand the purpose of the array wrapping the object for each element.

    If you can think of a better way to access data from the JSON within MMF2/CTF2.5, let me know - dealing with nested structures in Fusion is not as straightforward as in programming languages.

    Working as fast as I can on Fusion 3

  • Slightly off-topic, but I still think a Javascript scripting extension (that doesn't require MMF2 Developer and isn't based on Microsoft's Javascript engine) would be a better way to go.
    I'm already using the WebView object for exactly this sort of thing, and it's so simple just to write a couple of Javascript functions to read & write variables in MMF2 - and you can use JSON.stringify() / parse() to easily save and load everything.

    As you say, JSON doesn't really mesh well with MMF2 (the XML extensions are also pretty cumbersome, for the same reason), so I think it's actually easier to write some of the functions yourself.

  • The world of web development is moving from XML to JSON, regardless of programming language, so any scripting extension for any language with JSON support will do.

    I'm still trying to think of less cumbersome ways to access JSON via an extension. The major roadblock is that JSON object keys are unlimited in the characters they can contain, so I can't do something as simples as "blah.meh.hello" because in many real-world cases JSON object keys contain spaces, periods, etc.

    I am thinking of perhaps easing access to JSONs with known structures by allowing he creation of access templates, but how this will work I am still mulling over in my head.

    Working as fast as I can on Fusion 3

  • Quote

    but I don't understand why you are trying to hard-code the loop instead of dynamically processing them?


    Because it seems like I didn't find any other solution.

    I used your json plugin in order to load a project in my application.
    In the json string (my example above was only an example), I have 17 values/strings for each object. I use a loop to load each object in F2.5, in this loop I have to - among other things - save each of 17 values in 17 different variable of my object.
    That's why I'm hard coding this looping process - I would think your extension would only need to declare "Go to Root", "Enter Object...", "Enter array index()" only once by event, and then just return the value from a manually "Enter Object named("---")" action.

    If you have a solution....

  • Pharanygitis, it would take some work as I would have to rewrite the code to switch to a different library - I used James' json-parser which is read-only. For now though, it's not too hard to make a JSON string from scratch, only parsing is the hard part.

    I have it on the todo list but like looki I have to prioritize my education ;)

    Working as fast as I can on Fusion 3

  • I'm 100% sure that there exists a useable library for iOS to port this extension, however I don't have the time to make the port myself. The extension is open source and should be trivial for someone to port, however as this is still in beta there might be redesigns (such ass allowing for modifying/creating JSONs).

    Working as fast as I can on Fusion 3

  • It is already on GitHub - clickteam-plugin is for extensions worked on by multiple devs or extensions where the dev does not have a github account.
    Please login to see this link.

    Working as fast as I can on Fusion 3

  • Hi LB,

    Your extension is awesome. Thanks for making it.
    I currently have a crash when I load a JSON string in the object. This crash only happen in my project. When I try to reproduce it in another empty app, it doesn't crash and just work as expected.

    Can I send you the MFA which has the crash and see if you can fix it?

    Here the crash report (don't know if useful though...):

    Signature du problème*:
    Nom d’événement de problème: APPCRASH
    Nom de l’application: edrt.exe
    Version de l’application: 3.0.281.2
    Horodatage de l’application: 52e1006e
    Nom du module par défaut: JSON_Object.mfx
    Version du module par défaut: 1.0.0.1
    Horodateur du module par défaut: 51e297c2
    Code de l’exception: c0000005
    Décalage de l’exception: 00063329
    Version du système: 6.1.7601.2.1.0.768.3
    Identificateur de paramètres régionaux: 1036
    Information supplémentaire n°*1: 0a9e
    Information supplémentaire n°*2: 0a9e372d3b4ad19135b953a78882e789
    Information supplémentaire n°*3: 0a9e
    Information supplémentaire n°*4: 0a9e372d3b4ad19135b953a78882e789


    EDIT: I finally found how to reproduce the crash! This is very strange infact... If you add a subapp on the frame, then end the sub-application at start of frame and finally load a JSON string into the JSON Object, = CRASH

    Please login to see this attachment.

    Please login to see this link.

    Edited once, last by Sphax (March 2, 2014 at 12:10 AM).

  • @James: Ah, that's good to know - I keep thinking I can't use C/C++ with Objective-C

    Sphax: Yes, I should have some time to look into it. Unfortunately I don't know how to extract useful information from Windows crash reports, though.

    Working as fast as I can on Fusion 3

  • LB: I investigate a bit more and the problem seems bigger than expected.

    When the sub-app is ended or destroyed, loading JSON crashes the main app.
    When the sub-app is running, no crash but the JSON parsing doesn't work at all. Look at the MFA I joined in my previous post (I edited just before you replied)...


    On a side note to enhance this object, I would love to see these features:

    1) FloatValue() function should return the value even if it is formatted as an integer (but as a float for Fusion)... I don't know if it can be considered as a bug but when a number like "5" is read with FloatValue, it returns "0" instead of "5.0". Same for Double.

    2) IntegerValue() function should return the value even if it is formatted as a float (but as an Integer for Fusion). Currently if I read 5.0 or 5.2, the function returns "0" instead of "5"... Same for Long.

    3) Easy access to strings and float/integer. Like the INI, it would be very useful to read easily the values. Some functions like IntegerValueFromObject("json", > Object name < ) and FloatValueFromObject("json", > Object name < ) would be awesome.

    4) Easy access to arrays and 2D array. Some functions like FloatFromArray("json", > index (0-based) <) and FloatFrom2DArray("json", > X index <, > Y index <) would be very welcomed.

    Those things would make the usability of the object a lot more easier, faster and optimized in any Fusion App. :)

    Please login to see this link.

    Edited 2 times, last by Sphax (March 2, 2014 at 5:24 PM).

  • 2 new bugs I discovered:

    1) GetFloat and GetDouble always return 1 when the value is formatted as required like "0.1" or "10.2"
    2) Entering an object which does not exist do not work, so when we use "Go to parent", the object is lost and nothing next work anymore... This force the use of "Go to root".

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!