json - MergJSON error "...unexpected token near end of file"? -


i have simplest of scripts in livecode attempting parse small chunk of json using mergjson library.

this doubtless stupid i'm doing it's been long day, can't json parsed livecode array:

lc script in button called 'connect'

function jsontoarray pjson    local tarray,tkeys    repeat each line tkey in mergjsondecode(pjson,"tarray")    put jsontoarray(tarray[tkey]) tarray[tkey]    end repeat    return tarray end jsontoarray  on mouseup    put field "myjson" pjson    answer jsontoarray() end mouseup 

my json

{ "firstname":"mary", "lastname":"smith", } 

the error:

button "connect": execution error @ line n/a (external handler: exception) near "could not decode json: unexpected token near end of file"

suggestions welcome....

thanks,

steve

mark b might have other thing you're not passing parameter jsontoarray...

put jsontoarray(pjson) tarray put tarray["firstname"] 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -