Accessing JSON output
Posted: Thu Jul 23, 2020 12:58 am
Hello,
I am new to LiveCode, long history of writing just about everything else, so my thought processes are more class oriented and \" is how you put a double quote into a string, been that way for 50 years, where did \q come from?
So it took me a while to find a way to input a JSON sample string into LiveCode.
Reading a text file works best - don't have to fart around with quote games.
local myText;
local theFilePath;
answer file "A text file"
if it <> "" then
put it into theFilePath
put URL ("file:" & theFilePath) into myText
end if
Now that I have a sample JSON string stuck into LiveCode, I did the following:
local tArray;
put JsonImport(myText) into tArray;
OK, now I have some unknown structure in tArray.
In the debugger I can see:
Now how do I access the pieces of whatever it is that is?
Thanks,
Andrew
I am new to LiveCode, long history of writing just about everything else, so my thought processes are more class oriented and \" is how you put a double quote into a string, been that way for 50 years, where did \q come from?
So it took me a while to find a way to input a JSON sample string into LiveCode.
Reading a text file works best - don't have to fart around with quote games.
local myText;
local theFilePath;
answer file "A text file"
if it <> "" then
put it into theFilePath
put URL ("file:" & theFilePath) into myText
end if
Now that I have a sample JSON string stuck into LiveCode, I did the following:
local tArray;
put JsonImport(myText) into tArray;
OK, now I have some unknown structure in tArray.
In the debugger I can see:
Now how do I access the pieces of whatever it is that is?
Thanks,
Andrew