JSON

J. Landman Gay jacque at hyperactivesw.com
Tue Jun 4 18:57:46 EDT 2013


On 6/4/13 4:55 PM, Thomas McGrath III wrote:
> Thanks for the info. I am trying to use Igor's library and I am trying to build my first array to convert to json.
>
> This is the info I have to send as json:
> {"data":
> {"appuser_details":
> {
> "name":"Tom_iPad",
> "email":"iPad at gmail.com",
> "device_type":"2",
> "dentist_id":"73",
> "device_token":"98be5c7a3cc9e400ae6a90977ac6d64f498bb01cbe83c3c3d1bb4856de59ba1c"
> }
> }
> }
>
> I think I need to send "text/json" as a header.
>
> I have tried many things but I don't think I am sending the information correctly.
>
> I got a result "error 400 Bad Request"
>
> I don't think my array is right.

I got the same error at first. The web server can't understand what 
you're sending.

You just need to create a regular LiveCode array (none of that 
punctuation stuff,) pass it through Igor's library, and then send a POST 
with whatever you get back. I'm not sure about the headers, I don't 
think I had to change those but it might depend on the server.

Something like this off the top of my head:

put "Tom_iPad" into tArray["data"]["appuser_details"]["name"]
put "iPad at gmail.com" into tArray["data"]["appuser_details"]["email"]
...etc
put jsonFromArray(tArray) into tJSON
post tJSON to "http://xxx.xxx"

You might have to twiddle that a bit.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list