JSON Help, Response from ASYNC HTTP

A

Anthony Summers

Guest
So I got the json response back as

{"success":0,"message":"Email already used, please log in."} lets call this string variable json.

I use

obj =json_decode(json);

Most languages I used I would then use obj.success. And that would be all she wrote. Game maker decode seems to not be friendly and requires like 12 other lines on the guide to work properly but Im unable to get that to work. Maybe the example the gave just intimidates me and I'm psyching myself out but I am unable to print out success or message values.

Can someone explain to me how I just print out the obj value that equals to success or message and help me understand it better.

Thank you.
 
Last edited by a moderator:

FrostyCat

Member
12 lines of GML to listen for response from HTTP makes some sense, but 12 lines of GML to get at a top-level value in a JSON structure is fake news. In your example, the only line needed after what you posted is obj[? "success"].
 
A

Anthony Summers

Guest
12 lines of GML to listen for response from HTTP makes some sense, but 12 lines of GML to get at a top-level value in a JSON structure is fake news. In your example, the only line needed after what you posted is obj[? "success"].
yes thank you so much. What does the question mark do? Just so I can understand what is happening.
 
Top