How do I get data from parsed json to text object?

0 favourites
  • 7 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Is there a way to put the parsed json string into a text object? I just want to dump it in there. The image below did not work.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you wait for the AJAX request to finish before trying to parse ajax.lastdata?

  • Did you wait for the AJAX request to finish before trying to parse ajax.lastdata?

    Yes, I get the data (see the image). Now I just want to throw it into a text object. I think there's something simple that I'm missing, but I tried all different ways.

  • Is your text object large enough to fit the entire string? It won't show up if it doesn't fit within the object. Or use a textinput instead.

    Also maybe turn bbcode off.

  • Tried turning off "Enable BB code", it still did not work. Also tried a text input and it did not work.

    The thing is, in the debugger, I can copy the text from the JSON instance data and paste it into the text object. Then my code continues on and works fine (loads up a dictionary). This has to be easy to do in C3, I just have no clue how to do it. I tried to do this with a script, but I'm no javascript programmer and of course that didn't work for me.

    I really didn't want to loop through with keys and such to load my dictionary (seems to be confusing to me).

  • Does it work if you just put ajax.lastdata directly into the text object?

    I think the parse action just loads it into the json object so that the json object can interface with it by keys. Not too familiar with that though.

  • It will work if I load directly into the text object, however, it comes with a lot of escape characters and spaces added. If I use the json parse then it gets rid of the escape chars (but I'm finding the extra spaces are still there). Note that I'm getting the data from mySQL database. The data started out in C3 as arrays that I put into a dictionary and then stored in the database. When I retrieve it, it's filled with many escape chars.

    Originally, I did this, and removed all added \ and spaces, and it worked, but it seemed messy. I guess I'll have to do it this way, it just seems so wrong.

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