Json Manager (Construct 3 Plugins)

You're viewing a single comment in a conversation. View all the comments
  • 15 Comments

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

      • I just managed to load the json by putting a hard-coded ajax call into the json managers file field. So this works great!

        But, what i would need to to build up the ajax http string dynamically and then set the for the json manager and then do the call.

        can this be done?

    • 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

      • I just published version 1.0.1 which adds a new action to load json from a string. The action is called Load Json From String. Hope this helps

        • This is great!

          I will try it out immediately :-)

          thank you,

          Daniel

          • No Problem

            I also updated the example project to include this new functionality if you need to look at it.

            • Looks like i have trouble to get it to work. I downloaded the new sample, but couldn't see in it an example of loading from string.

              Could you perhaps past some instructions here or create a sample dedicated for loading from string -- if possible.

              Essentially, i create a new slot in the UI "s1", i then in the event action that follows the ajax on complete, i loaded into s1 the ajax.lastdata ... i then wanted to see in the debug window that the json manager includes the data, but its empty.

              thank you,

              Dan

              • I'm away from my computer now for a bit. The example should have a load from string button. You don't have to specify the slot in the ui. The load string will create the slot. I haven't hooked up any out put to the debug window yet. The easiest way is to use the browser alert and use the json manager to get a value

                You don't have to use the original load method if you are using the string one.

                • Hi,

                  I got it to work! (and noticed the loadstring in the example).

                  I got one problem left, though -- probably related to the json format google sheet returns:

                  It looks like this:

                  In trying to get the values into a dictionary or array, i am getting lots of brackets like: [[["str1"]]]

                  and when trying to loop over things its not clear to me what the query expression is after "values", to get at individual strings.

                  The objective is to get all of them into a listbox.

                  any thoughts are much appreciated.

                  Dan

                  {

                  "range": "Sheet1!A4:A7",

                  "majorDimension": "ROWS",

                  "values": [ [ "str1" ],

                  [ "str2" ],

                  [ "str3" ]

                  ]

                  }

                  Load more comments (4 replies)
      • I know I am double posting, I didn't pay attention that i replied to the same person in the forums :) I will look at adding the ability to load json from a string as an option.