Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 50

Thread: [Beta] JSON Object

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,922

    [Beta] JSON Object

    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: http://www.LB-Stuff.com/MMF2/Extensions/JSON_Object.zip

    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

  2. #2
    Finally extension is debuggued.
    So.. I was a good job to come back to the front this topic (http://community.clickteam.com/threa...eg-JSON-Object) 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: ICI
    EN: HERE

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

  3. #3

    [Beta] JSON Object

    Can't wait to get home and check this out!!

  4. #4
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleMac Export ModuleInstall Creator Pro
    iOSC's Avatar
    Join Date
    Mar 2012
    Location
    Toronto, Canada
    Posts
    405
    LB, I'm trying your beta json object.
    I have a json string like this :
    Code:
    {
        "elem1": [
            {
                "uid": "1",
                "id": "1"
            }
        ],
        "elem2": [
            {
                "uid": "2",
                "id": "2"
            }
        ]
    ....
    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!

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,922
    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.

  6. #6
    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.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,922
    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.

  8. #8
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleMac Export ModuleInstall Creator Pro
    iOSC's Avatar
    Join Date
    Mar 2012
    Location
    Toronto, Canada
    Posts
    405
    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....

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,922
    You don't have to continually start over from the root, you can go back up to the parent object instead.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-on
    Pharanygitis's Avatar
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    1,037
    Blog Entries
    1
    This is very great LB. Can you add json_encode/create ?

Page 1 of 5 1 2 3 ... LastLast

Similar Threads

  1. [Request/Beg] JSON Object
    By DizzyDoo in forum Extension Development
    Replies: 25
    Last Post: 16th July 2013, 02:06 AM
  2. [Request] JSON Object
    By ItsAUsername in forum Extension Development
    Replies: 33
    Last Post: 13th May 2013, 06:34 PM
  3. JSON Object ?
    By Rushino in forum Extension Development
    Replies: 0
    Last Post: 3rd April 2013, 05:48 PM
  4. [Beta] EDIF JSON Generator (QuickTest)
    By RickyRombo in forum Extension Development
    Replies: 2
    Last Post: 18th August 2011, 04:22 AM
  5. JSON object idea
    By ChrisB in forum Extension Developers Lobby
    Replies: 5
    Last Post: 24th September 2007, 11:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •