I have the simplest of scripts in LiveCode attempting to parse a small chunk of JSON using the MergJSON library.
This is doubtless something stupid I'm doing as it's been a long day, but I just can't get the JSON parsed into a LiveCode array:
LC Script in a button called 'Connect'
function JSONToArray pJSON
local tArray,tKeys
repeat for each line tKey in mergJSONDecode(pJSON,"tArray")
put JSONToArray(tArray[tKey]) into tArray[tKey]
end repeat
return tArray
end JSONToArray
on mouseUp
put field "MyJSON" into pJSON
answer JSONToArray()
end mouseUp
My JSON
{
"firstname":"Mary",
"lastname":"Smith",
}
The Error:
Button "Connect": execution error at line n/a (External handler: exception) near "could not decode JSON: unexpected token near end of file"
Suggestions would be most welcome....
Thanks,
Steve