ACES

A list of all Actions, Conditions and Expressions supported in this addon.

JSON Looping

  • Conditions

    Loop over {0} with query {1}. {2} nested in another json loop

    Json array loop: Over a slot using a query.

  • Expressions

    JsonLoopIndex

    Json loop index: current loop index of a Json loop.

JSON

  • Actions

    Load Json: Cache Enable is {0}

    Load Json: All files into correct slots

    Load Json From String: Cache Enable is {2} from {1} into slot {0}

    Load Json From String: Load Json string into a slot

    Reset Json slot: {0} back to it's original value.

    Reset Json slot back to it's original value when it was first loaded.

    Clear Slot: {0}

    Clear Json slot.

    Create new slot: Query {1} and copy from {0} to {2}. {3} in json loop

    Create new slot by duplicating a Json sub object into a new slot.

    Set Json Value: Set {3} into {0} and {2}, using {1}. {4} in json loop

    Set Json Value: Set a value to a specific field in the Json object.

  • Conditions

    On Json loaded

    Triggered when: All Json files have been loaded.

  • Expressions

    GetJsonValue

    Get json value: Using standard Json notation.

    GetJsonArrayLength

    Get length: Array within a Json object.

JSON Conversion

  • Expressions

    GetArrayFromJsonPath

    C3 array: Get formatted json string in array form.

    GetDictionaryFromJsonPath

    C3 dictionary: Get formatted json string in dictionary form.

Download

1.2.0 Stable (17 KB)

Info

  • License MIT License
  • Copyright Robert Greenberg. All rights reserved.

Statistics

  • Download count 153 total downloads
  • Latest download count 17 downloads of latest version
  • Average download count 2 downloads per day average

Owners

Tags

  • 31 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Great job rhg - it's nice to have a fully featured JSON plugin for the C3 runtime!

    • [-] [+]
    • 1 points
    • (2 children)
    [deleted]
    • it is my mistake , i found the mistake.

    • I will take a look at it. But looking at your example the first things that strikes me is getting a dictionary works by pointing at simple javascript object with properties, not an array. So in that case the query to use with the GetDictionaryFromJsonPath would be something like slot.friendlist[0]. I will look at this to make sure though

      Edit:

      Just tried it with your example and it works fine by loading a dictionary with the following:

      JsonManager.GetDictionaryFromJsonPath("world", "friendlist[0]", "No")

      You could also do something like:

      JsonManager.GetDictionaryFromJsonPath("world", "friendlist[" & str(JsonManager.GetJsonArrayLength("world", "friendlist", "No")-1) &"]", "No")

  • Could you add a condition that tests for when the loop has completed. I.e. its true *after* the last loop item has been processed.

    This would be ideal to trigger post-loop action, such as selecting an element in a listbox, that was filled with the the loop

    thank you,

    Dan

    • You could just put a condition after the loop that will run as soon as the loop is done. I don't know if you really need an event for this.

      Also for commas in a string I would start1 with an empty string. Then when you try to append to it check if its empty. If its empty just add the string. If it's not empty add a comma first and then the string. Then you never have to worry about having too many commas

    • btw, sometimes its useful to also have a condition that tests true for when the last loop item processes, or even also the one before the last one. This helps customize construction tasks such a creation of json strings, where for last elements one does not add commas anymore.

  • It would be great if there could be additional dictionary like functionality, to construct a json, which can then be obtained via a toJson method.

    In my app, i need to update values in a google sheet. This means constructing an update json string as data for a ajax put call.

    now, the only way to do it is to build the string using concats

  • Hi,

    Was wondering if you got the link and were able to donwload it.

    thank you,

    Dan

  • To bad, that JSON manager doesn't load from a variable -- such as after receiving JSON via an Ajax call response.

    • It loads the json file through ajax itself internally. The example project shows how that works. Since it handles the ajax call behind the scenes, I didn't think it would be necessary to load it from a string. I can certainly look at adding that functionality if you feel it's really needed and can't be met using the functions in the plugin to load itself with the data.

      • Hi, just to clarify -- after reading the documentation.

        I noticed one could load json via a URL -- but, my use case is different ... i am obtaining a json response string after an ajax call (to google sheets) -- so its dynamically generated after the call. I can the access it via ajax.lastData.

        It would be great if i could load ajax.lastData into the jason manager.

        Load more comments (1 replies)
      • Hi,

        Thank you for your reply.

        I was trying all morning to figure out how to access a json structure i received from google sheets (just posted a question in the forum).

        I wasn't able to figure it out so far.

        I think if you can support an ajax call via an ajax string and then auto-magically have the respond available that would be great.

        Alternatively, i think reading in json from a string would make the plugin more flexible ...

        thank you,

        Dan

        Load more comments (12 replies)
  • thanks, pretty much needed :)