How do I store a Array of JSONs inside an Array ?

0 favourites
  • 4 posts
From the Asset Store
290 static tiles (32x32 in size) + 2 animations for use in your project!
  • This is the JSON, one of it:


    There will be many many more of this and I want to store them into a Single Array so that I can later extract one of the JSON out and put it into a Dictionary at a later runtime operation.

    Anyone knows how to do this ?

    Can Array in C2 Store JSONs or I have really hit a brick this time ?

  • JSON's are just text and text can be stored in an array if that's what you're asking. If you get the text from a dictionary you can just store it in the array with the dictionary.asJSON expression. If you want to store the text directly you have to change all the " to "" or ' and then put quotes around the whole thing.

    Either of these are valid c2 strings of text:

  • R0J0hound, thanks for being such an awesome guy.

    Now what if Mr.Garrison name is for example Gar's"a ? Would both the single quote or double quite method fail ?

    and to generate this output manually in php is pretty insane

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you're getting it from php I'm guessing you're using Ajax or something to get it. In which case you can just set the indexes of the array with Ajax.lastdata. No manipulating of the text required.

    My solution above is if you're typing the above json in directly.

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