JSON Parse (fill to 15 characters)

Hello all,
I’m trying to PARSE a JSON file.
I’m caling dreamto service.
If I have only one record I can read it.
example:
with this JSON
{“dreamlo”:{“leaderboard”:{“entry”:{“name”:“Pippo”,“score”:“200”,“seconds”:“0”,“text”:"",“date”:“5/24/2020 8:52:47 PM”}}}}
I move the name using the code:
SET text: VariableString(jsonresponse.dreamlo.leaderboard.entry[“name”])
name is child of entry that is child of leaderboard that is child of dreamlo OK
but if I add a line:

{“dreamlo”:{“leaderboard”:{“entry”:[{“name”:“Pippo”,“score”:“200”,“seconds”:“0”,“text”:"",“date”:“5/24/2020 8:52:47 PM”},{“name”:“Mike”,“score”:“200”,“seconds”:“0”,“text”:"",“date”:“5/24/2020 9:15:12 PM”}]}}}

I’m not able to manage it. .

Can someone help me ?
Thanks,
J

take a look at here and here
A few days ago I struggle my head trying to parse Json, at last I made it parsing to a variable. Then pay attention to the double and single quotes and how to escape them

Thanks a lot.
I tested them ( the star wars one service is offline but it wasn’t a problem).
They can’t help me because that JSON aren,'t array but flat parameters.

Thanks for your help,
J

hi, i just figure out how to parse JSON from dreamlo recently

first you get JSON string from dreamlo and save it into a variable, like “raw”, then you use “parse JSON string” into another vairable, like “convertHighScore”, then you can call the string just follow it’s structure, like “convertHighScore.dreamlo.leaderbard.entry.0.name” or “convertHighScore.dreamlo.leaderbard.entry.0.score”

sp200525_231541

you can check the structure in the debugger screen, it will show you a lot of information.
sp200525_231647

1 Like

Thanks a lot. I resolved using this code:

that’s neat! i’m a newbie, my code is so garbage~ never thought that, thanks! :joy:

2 Likes

Hi @jumpingj,

Could I ask what is the Variable “Instance” do? That’s an object variable, right? Do you set it to a specific number?

I created only one text object with a object variable name Instance. I have put 10 instance of the object changing instance values from 0 to 9. I think it is more simple than have 10 different objects

2 Likes

Ah~ got it, thank you very much!

2 Likes

How can I assign the value of “name:” to a string variable?
I acquired the ranking from DREAMLO and assigned it to the “raw” variable. Then with JSON I brought the value to the string variable “classifica” (as in the image below), but how can I do to assign only the content of “name:” ( “Salvatore”, “Matteo”, Carmine ") to a string variable ?


can someone tell me how to read the various values within the JSON and assign them to the individual variables? (name, score …)
I have read in WIKI and seen the various discussions in the forum, but I can’t …

xxxxxxxxxxxxxxxxxxx

Resolved :stuck_out_tongue_winking_eye::stuck_out_tongue_closed_eyes:
xxxxxxxxxxxxxxxxxxx