Re: JSON

2023-08-15 Thread Tore Nilsen via use-livecode
An array of object would be turned into a multidimensional  array with value 
pairs in LiveCode. Depending on the source the main keys may be numeric or 
assosiative, like in these examples:

contriesArray[1][name]
contriesArray[1][capitol]
contriesArray[1][inhabitants]

Or 

contriesArray[«Norway"][capitol]
contriesArray[«Norway»][inhabitants]

Tore


> 15. aug. 2023 kl. 15:46 skrev Dar Scott via use-livecode 
> :
> 
> Thanks, Tore!
> 
> I found these in the dictionary. For JsonImport I noted this:
> 
> The return value may be any of the following types, depending on the content 
> of the file:
> 
> Array (for a JSON object)
> List (for a JSON array)
> String (for a JSON string)
> Number (for any JSON number)
> Boolean (for JSON true or false)
> nothing (for JSON null)
> How would an array of objects be translated? What is nothing?
> 
> Dar
> 
> 
>> On Aug 14, 2023, at 10:58 PM, Tore Nilsen via use-livecode 
>>  wrote:
>> 
>> JsonImport will make an array of your JSON data, whereas JsonExport will 
>> turn your array into JSON data. Not much fiddling there.
>> 
>> Best regards
>> Tore Nilsen
>> 
>>> 15. aug. 2023 kl. 02:07 skrev Dar Scott via use-livecode 
>>> :
>>> 
>>> 
>>> I’m about write some scripts that fiddle with JSON. I have some old stacks 
>>> of mine about someplace. But, I got to thinking there might be something 
>>> faster about someplace. Ideas?
>>> 
>>> Dar
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2023-08-15 Thread Dar Scott via use-livecode
Thanks, Tore!

I found these in the dictionary. For JsonImport I noted this:

The return value may be any of the following types, depending on the content of 
the file:

Array (for a JSON object)
List (for a JSON array)
String (for a JSON string)
Number (for any JSON number)
Boolean (for JSON true or false)
nothing (for JSON null)
How would an array of objects be translated? What is nothing?

Dar


> On Aug 14, 2023, at 10:58 PM, Tore Nilsen via use-livecode 
>  wrote:
> 
> JsonImport will make an array of your JSON data, whereas JsonExport will turn 
> your array into JSON data. Not much fiddling there.
> 
> Best regards
> Tore Nilsen
> 
>> 15. aug. 2023 kl. 02:07 skrev Dar Scott via use-livecode 
>> :
>> 
>> 
>> I’m about write some scripts that fiddle with JSON. I have some old stacks 
>> of mine about someplace. But, I got to thinking there might be something 
>> faster about someplace. Ideas?
>> 
>> Dar
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2023-08-14 Thread Richmond Mathewson via use-livecode
This has recently been explored across on the forums where I managed to
expose my full level of ignorance on the subject.

Best, Richmond.

On Tue, 15 Aug 2023, 07:59 Tore Nilsen via use-livecode, <
use-livecode@lists.runrev.com> wrote:

> JsonImport will make an array of your JSON data, whereas JsonExport will
> turn your array into JSON data. Not much fiddling there.
>
> Best regards
> Tore Nilsen
>
> > 15. aug. 2023 kl. 02:07 skrev Dar Scott via use-livecode <
> use-livecode@lists.runrev.com>:
> >
> >
> > I’m about write some scripts that fiddle with JSON. I have some old
> stacks of mine about someplace. But, I got to thinking there might be
> something faster about someplace. Ideas?
> >
> > Dar
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2023-08-14 Thread Tore Nilsen via use-livecode
JsonImport will make an array of your JSON data, whereas JsonExport will turn 
your array into JSON data. Not much fiddling there.

Best regards
Tore Nilsen

> 15. aug. 2023 kl. 02:07 skrev Dar Scott via use-livecode 
> :
> 
> 
> I’m about write some scripts that fiddle with JSON. I have some old stacks of 
> mine about someplace. But, I got to thinking there might be something faster 
> about someplace. Ideas?
> 
> Dar
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON to Datagrid

2021-12-08 Thread Tom Glod via use-livecode
JSONToArray works well for me if your JSON is correct.
Always use try when decoding from JSON to catch any errors.

On Wed, Dec 8, 2021 at 12:58 PM Mike Kerner via use-livecode <
use-livecode@lists.runrev.com> wrote:

> completely off the top of my head, so this might not be quite right
> jsonToArray
> set the dgData of group "datagrid 1" to 
>
> On Wed, Dec 8, 2021 at 11:39 AM Keith Clarke via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
> > Hi Skip,
> > I don’t use Datagrids but have used a two-step process to get JSON into
> > the Tree widget and a similar process may provide a direction of travel
> to
> > test…?
> >
> > 1. JSON-to-array
> >
> https://lessons.livecode.com/m/4071/l/1303394-how-to-read-in-data-from-a-json-file
> > 2. Setting the array data of datagrid…
> >
> > Good luck.
> > Best,
> > Keith
> >
> > > On 8 Dec 2021, at 16:15, Skip Kimpel via use-livecode <
> > use-livecode@lists.runrev.com> wrote:
> > >
> > > I have been googling a solution for this but have not found a solid
> > > solution for this.
> > >
> > > Can anybody lead me in the right direction on this?
> > >
> > > SKIP
> > > ___
> > > use-livecode mailing list
> > > use-livecode@lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>and did a little diving.
> And God said, "This is good."
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Tom Glod
Founder & Developer
MakeShyft R.D.A (www.makeshyft.com)
Mobile:647.562.9411
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON to Datagrid

2021-12-08 Thread Mike Kerner via use-livecode
completely off the top of my head, so this might not be quite right
jsonToArray
set the dgData of group "datagrid 1" to 

On Wed, Dec 8, 2021 at 11:39 AM Keith Clarke via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi Skip,
> I don’t use Datagrids but have used a two-step process to get JSON into
> the Tree widget and a similar process may provide a direction of travel to
> test…?
>
> 1. JSON-to-array
> https://lessons.livecode.com/m/4071/l/1303394-how-to-read-in-data-from-a-json-file
> 2. Setting the array data of datagrid…
>
> Good luck.
> Best,
> Keith
>
> > On 8 Dec 2021, at 16:15, Skip Kimpel via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > I have been googling a solution for this but have not found a solid
> > solution for this.
> >
> > Can anybody lead me in the right direction on this?
> >
> > SKIP
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON to Datagrid

2021-12-08 Thread Keith Clarke via use-livecode
Hi Skip,
I don’t use Datagrids but have used a two-step process to get JSON into the 
Tree widget and a similar process may provide a direction of travel to test…?

1. JSON-to-array 
https://lessons.livecode.com/m/4071/l/1303394-how-to-read-in-data-from-a-json-file
 
2. Setting the array data of datagrid…

Good luck.
Best,
Keith

> On 8 Dec 2021, at 16:15, Skip Kimpel via use-livecode 
>  wrote:
> 
> I have been googling a solution for this but have not found a solid
> solution for this.
> 
> Can anybody lead me in the right direction on this?
> 
> SKIP
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON to Datagrid

2021-12-08 Thread Skip Kimpel via use-livecode
To functions actually needed... need to be able to convert to a datagrid
and I will be also pumping this data into a SQL server.

SKIP

On Wed, Dec 8, 2021 at 11:15 AM Skip Kimpel  wrote:

> I have been googling a solution for this but have not found a solid
> solution for this.
>
> Can anybody lead me in the right direction on this?
>
> SKIP
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-03 Thread Dave Kilroy via use-livecode
quite agree, and as Jacque says “its the law” - and only the brave own up to 
their DOH! moments (of which I have several every hour)

kind regards

dave

>  From the thrid party perspective, it doesn’t matter whether the OP has an 
> epiphany, or another list contributor solves the problem.  All is good 
> interesting and helpful.   It’s also nice to see that even the wise ones have 
> the same 'moments of discovery' that the rest of us do. 
> 
> David G 
> 
> 
> > On 2 Nov 2017, at 6:57 pm, J. Landman Gay via use-livecode <[hidden email] 
> > >
> >  wrote: 
> > 
> > On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote: 
> >> https://en.wikipedia.org/wiki/Rubber_duck_debugging 
> >>  
> >>  >> > 
> > 
> > Yeah. Story of my life. I've since hit another error in the JSON import but 
> > now I'm afraid to post about it. :) 
> > 
> > -- 
> > Jacqueline Landman Gay | [hidden email] 
> > 
> >  
> > HyperActive Software   | http://www.hyperactivesw.com 
> > 
> >



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON import error

2017-11-03 Thread Mark Wieder via use-livecode

On 11/03/2017 05:03 AM, Phil Jimmieson via use-livecode wrote:

Or when you’re preparing an example stack for the bug report and realise that 
it’s not a bug, you’ve been doing it wrong...


Normally I find that right *after* filing the bug report.

--
 Mark Wieder
 ahsoftw...@gmail.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON import error

2017-11-03 Thread Mark Waddingham via use-livecode

On 2017-11-03 13:03, Phil Jimmieson via use-livecode wrote:

Or when you’re preparing an example stack for the bug report and
realise that it’s not a bug, you’ve been doing it wrong...


Recipe stacks for bugs are useful for all kinds of reasons ;)

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON import error

2017-11-03 Thread Phil Jimmieson via use-livecode
Or when you’re preparing an example stack for the bug report and realise that 
it’s not a bug, you’ve been doing it wrong...

> On 3 Nov 2017, at 11:55, Mark Waddingham via use-livecode 
>  wrote:
> 
> On 2017-11-02 19:57, J. Landman Gay via use-livecode wrote:
>> On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:
>>> https://en.wikipedia.org/wiki/Rubber_duck_debugging 
>>> 
>> Yeah. Story of my life. I've since hit another error in the JSON
>> import but now I'm afraid to post about it. :)
> 
> I do this all the time - quite often just trying to pose the question to 
> explain the problem leads to the solution :)
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Phil Jimmieson  p...@liverpool.ac.uk  (UK) 0151 795 4236  (Mobile) 07976 983164
Computer Science Dept., Liverpool University, Ashton Building, Ashton Street
Liverpool L69 3BX  http://intranet.csc.liv.ac.uk/~phil/
I used to sit on a special medical board... ...but now I use this ointment.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON import error

2017-11-03 Thread Mark Waddingham via use-livecode

On 2017-11-02 19:57, J. Landman Gay via use-livecode wrote:

On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:
https://en.wikipedia.org/wiki/Rubber_duck_debugging 



Yeah. Story of my life. I've since hit another error in the JSON
import but now I'm afraid to post about it. :)


I do this all the time - quite often just trying to pose the question to 
explain the problem leads to the solution :)


Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-03 Thread David V Glasgow via use-livecode
 From the thrid party perspective, it doesn’t matter whether the OP has an 
epiphany, or another list contributor solves the problem.  All is good 
interesting and helpful.   It’s also nice to see that even the wise ones have 
the same 'moments of discovery' that the rest of us do.

David G


> On 2 Nov 2017, at 6:57 pm, J. Landman Gay via use-livecode 
>  wrote:
> 
> On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:
>> https://en.wikipedia.org/wiki/Rubber_duck_debugging 
>> 
> 
> Yeah. Story of my life. I've since hit another error in the JSON import but 
> now I'm afraid to post about it. :)
> 
> -- 
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON import error

2017-11-02 Thread J. Landman Gay via use-livecode

On 11/2/17 2:45 PM, Mark Wieder via use-livecode wrote:

On 11/02/2017 11:57 AM, J. Landman Gay via use-livecode wrote:

On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:
https://en.wikipedia.org/wiki/Rubber_duck_debugging 



Yeah. Story of my life. I've since hit another error in the JSON 
import but now I'm afraid to post about it. :)




Anything having to do with lists/collections?

http://quality.livecode.com/show_bug.cgi?id=19698



I don't think so. The import works with most of the 300 entries in the 
file, but fails on a few with identical syntax that contain some unusual 
characters. I've reported it.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-02 Thread Mark Wieder via use-livecode

On 11/02/2017 11:57 AM, J. Landman Gay via use-livecode wrote:

On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:
https://en.wikipedia.org/wiki/Rubber_duck_debugging 



Yeah. Story of my life. I've since hit another error in the JSON import 
but now I'm afraid to post about it. :)




Anything having to do with lists/collections?

http://quality.livecode.com/show_bug.cgi?id=19698

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-02 Thread J. Landman Gay via use-livecode

On 11/2/17 6:52 AM, Dave Kilroy via use-livecode wrote:

https://en.wikipedia.org/wiki/Rubber_duck_debugging 



Yeah. Story of my life. I've since hit another error in the JSON import 
but now I'm afraid to post about it. :)


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-02 Thread Dave Kilroy via use-livecode
https://en.wikipedia.org/wiki/Rubber_duck_debugging 



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-02 Thread Monte Goulding via use-livecode
file: will recognise the BOM and decode the text correctly. 

> On 2 Nov 2017, at 5:36 pm, J. Landman Gay via use-livecode 
>  wrote:
> 
> I sent my message too soon. If I import as "file:" instead of "binfile:" it 
> mostly works.
> 
> You always figure it out as soon as you post. It's a rule.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON import error

2017-11-02 Thread J. Landman Gay via use-livecode
I sent my message too soon. If I import as "file:" instead of "binfile:" 
it mostly works.


You always figure it out as soon as you post. It's a rule.

On 11/2/17 1:02 AM, J. Landman Gay via use-livecode wrote:
I am trying to convert some JSON to a LC array. Both JSONImport and 
JSONToArray are failing. JSONToArray gives only a generic "error in 
function". JSONImport gives this:


863,9,9,runtime
864,9,9,syntax error: 1:1 Unexpected character '˛'
865,9,9,json.lcb
866,9,9,65
897,9,9,1
865,9,9,json.lcb
866,9,9,262
897,9,9,1
219,9,9,JSONimport
465,9,9

The JSON is full of foreign characters, saved on disk as UTF-16 (with 
BOM), and read into LC as binary text. I've run the text through several 
online JSON validators and none report any problems.


I don't know if the above error will come through the list correctly but 
it isn't a normal comma. LC's charToNum() reports 254. I pasted it into 
BBEdit's "find" dialog and when I do a search on the actual file, BBEdit 
says it doesn't exist in there.


Any ideas what might be wrong?




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON library on LC Server

2017-03-09 Thread Devin Asay via use-livecode

On Mar 9, 2017, at 10:31 AM, Devin Asay via use-livecode 
> wrote:

Can anyone tell me how/if one can use the JSON library from LC 8 on LC Server? 
I’m running Community Server v. 8.1.2 on a Linux server.

I tried just calling JsonExport() in the .lc script, but it errors. Do I have 
to ‘include’ or ‘start using’ the library somehow?

Answered my own question with another google search. Peter B. answered the 
question in this thread a few months back:

http://lists.runrev.com/pipermail/use-livecode/2015-November/221289.html

So here’s what I did:

Opened the LiveCode.app bundle on my Mac.

Navigated to Contents > Tools > Extensions .

Copied the com.livecode.library.json folder to the same folder on the server 
where my test script is.

Included this statement at the beginning of my .lc test script:

load extension from file "com.livecode.library.json/module.lcm”

Works like a champ!

But I wonder if there’s a less fiddly way to do it. Are these LCB libraries 
included in the LC server installation?

Devin


Devin Asay
Director
Office of Digital Humanities
Brigham Young University

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON commands are not in the dictionary

2016-07-14 Thread Sannyasin Brahmanathaswami
found it the release notes also

but the parts on json arrays/lists is esoteric… I'll start a different thread

From: use-livecode <use-livecode-boun...@lists.runrev.com> on behalf of Terry 
Judd <terry.j...@unimelb.edu.au>
Reply-To: How LiveCode <use-livecode@lists.runrev.com>
Date: Thursday, July 14, 2016 at 6:21 PM
To: How LiveCode <use-livecode@lists.runrev.com>
Subject: Re: JSON commands are not in the dictionary

Go to the Œsection¹ menu in the top left corner of the dictionary window
and select 'JSON Library¹.

Terry...
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON commands are not in the dictionary

2016-07-14 Thread Terry Judd
Go to the Œsection¹ menu in the top left corner of the dictionary window
and select 'JSON Library¹.

Terry...


On 15/07/2016 2:05 pm, "use-livecode on behalf of Sannyasin
Brahmanathaswami"  wrote:

>I can't find the new JSON commands encode and decode to and from arrays
>in the dictionary.
>
>I thought they were part of the engine now in 8
>
>An anyone point to docs? I look in release notes for 8.1  but no mention
>there.
>
>BR
>
>___
>use-livecode mailing list
>use-livecode@lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON not working in Standalones?

2016-06-20 Thread Ali Lloyd
> in 8.1.0 (dp 1) the new “Inclusions”-tab in the standalone settings is
disabled,
> so I can’t select anything there.

I suspect you may have the "search for inclusions" radio button selected
instead of the "select inclusions" one, in the General tab.

On Mon, Jun 20, 2016 at 1:44 PM Ton Kuypers 
wrote:

> Yes, that part I already figured out ;-)
>
> But is there a way to add the JSON-part or all of the mergExt to a
> standalone right now?
>
>
> Met vriendelijke groeten,
> Warm Regards,
>
>
>
> Ton Kuypers
> +32 (0) 477 739 530
>
> Steenweg op Leopoldsburg 100 • B-2490 • Balen • Belgium
> www.publishingtools4u.com
>
>
>
>
>
> > On 19 jun. 2016, at 00:30, Monte Goulding-2 [via Runtime Revolution] <
> ml-node+s278305n4705912...@n4.nabble.com> wrote:
> >
> > In 8.1.0 the mergExt externals are not yet being searched for so you
> need to manually select inclusions. Ali is working on a mechanism to allow
> searching for them.
> >
> > Cheers
> >
> > Monte
> >
> > Sent from my iPhone
> >
> > > On 19 Jun 2016, at 4:19 AM, [hidden email]
>  <[hidden email]
> > wrote:
> > >
> > > In all but  8.1.0 (dp 1) I’ve included all extensions, in 8.1.0 (dp 1)
> the new “Inclusions”-tab in the standalone settings is disabled, so I can’t
> select anything there.
> >
> >
> > ___
> > use-livecode mailing list
> > [hidden email] 
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode <
> http://lists.runrev.com/mailman/listinfo/use-livecode>
> >
> > If you reply to this email, your message will be added to the discussion
> below:
> >
> http://runtime-revolution.278305.n4.nabble.com/JSON-not-working-in-Standalones-tp4705904p4705912.html
> <
> http://runtime-revolution.278305.n4.nabble.com/JSON-not-working-in-Standalones-tp4705904p4705912.html
> >
> > To start a new topic under Revolution - User, email
> ml-node+s278305n278306...@n4.nabble.com
> > To unsubscribe from Revolution - User, click here <
> http://runtime-revolution.278305.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=278306=dGt1eXBlcnNAcHVibGlzaGluZ3Rvb2xzNHUuY29tfDI3ODMwNnw1ODc5MTUzNzU=
> >.
> > NAML <
> http://runtime-revolution.278305.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
> pt4u-3.jpg (9K) <
> http://runtime-revolution.278305.n4.nabble.com/attachment/4705967/0/pt4u-3.jpg
> >
>
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/JSON-not-working-in-Standalones-tp4705904p4705967.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON not working in Standalones?

2016-06-20 Thread Ton Kuypers
Yes, that part I already figured out ;-)

But is there a way to add the JSON-part or all of the mergExt to a standalone 
right now?


Met vriendelijke groeten,
Warm Regards,



Ton Kuypers
+32 (0) 477 739 530

Steenweg op Leopoldsburg 100 • B-2490 • Balen • Belgium
www.publishingtools4u.com





> On 19 jun. 2016, at 00:30, Monte Goulding-2 [via Runtime Revolution] 
>  wrote:
> 
> In 8.1.0 the mergExt externals are not yet being searched for so you need to 
> manually select inclusions. Ali is working on a mechanism to allow searching 
> for them. 
> 
> Cheers 
> 
> Monte 
> 
> Sent from my iPhone 
> 
> > On 19 Jun 2016, at 4:19 AM, [hidden email] 
> >  <[hidden email] 
> > > wrote: 
> > 
> > In all but  8.1.0 (dp 1) I’ve included all extensions, in 8.1.0 (dp 1) the 
> > new “Inclusions”-tab in the standalone settings is disabled, so I can’t 
> > select anything there. 
> 
> 
> ___ 
> use-livecode mailing list 
> [hidden email]  
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences: 
> http://lists.runrev.com/mailman/listinfo/use-livecode 
>  
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://runtime-revolution.278305.n4.nabble.com/JSON-not-working-in-Standalones-tp4705904p4705912.html
>  
> 
> To start a new topic under Revolution - User, email 
> ml-node+s278305n278306...@n4.nabble.com 
> To unsubscribe from Revolution - User, click here 
> .
> NAML 
> 


pt4u-3.jpg (9K) 





--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/JSON-not-working-in-Standalones-tp4705904p4705967.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON not working in Standalones?

2016-06-18 Thread Monte Goulding
In 8.1.0 the mergExt externals are not yet being searched for so you need to 
manually select inclusions. Ali is working on a mechanism to allow searching 
for them.

Cheers

Monte

Sent from my iPhone

> On 19 Jun 2016, at 4:19 AM, tkuyp...@telenet.be 
>  wrote:
> 
> In all but  8.1.0 (dp 1) I’ve included all extensions, in 8.1.0 (dp 1) the 
> new “Inclusions”-tab in the standalone settings is disabled, so I can’t 
> select anything there.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON library

2015-11-18 Thread Peter Haworth
Thanks Ali, that fixed it.  I'ma little surprised I didn't get a runtime
error in the standalone though - shouldn't it have choked on the jsonImport
command?

Pete
lcSQL Software 
Home of lcStackBrowser  and
SQLiteAdmin 

On Wed, Nov 18, 2015 at 12:46 AM, Ali Lloyd  wrote:

> Hi Peter,
> The JSON library is an extension and so you need to include it manually (at
> least at the moment) - you'll need to select com.livecode.library.json in
> the Copy Files pane of the standalone settings.
>
> On Tue, Nov 17, 2015 at 10:55 PM Peter Haworth  wrote:
>
> > A stack that works fine in the IDE does not work when I make a standalone
> > from it.  In particular, clicking on a scrolling list doesn't have the
> > desired effect.  I think it may be because I'm using the new JSONImport
> > function in my selectionChanged handler.  It's part of the JSON library
> and
> > perhaps the JSON library is not being included in the standalone.
> >
> > I used the default setting to search for inclusions initially.  When I
> try
> > to include specific libraries, the JSON library is not listed as one of
> the
> > options.
> >
> > The above is all pure guesswork of course but should the JSON library be
> > listed as an inclusion option?
> >
> > Pete
> > lcSQL Software 
> > Home of lcStackBrowser  and
> > SQLiteAdmin 
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON library

2015-11-18 Thread Peter TB Brett



On 18/11/2015 11:02, Lyn Teyla wrote:

Ali Lloyd wrote:


The JSON library is an extension and so you need to include it manually (at
least at the moment) - you'll need to select com.livecode.library.json in
the Copy Files pane of the standalone settings.



On a somewhat related note, how does one utilize this JSON library (and other 
libraries implemented as extensions) on LiveCode Server?



Currently, you will need to use `load extension` to load the appropriate 
`.lcm` file(s).


 Peter

--
Dr Peter Brett 
LiveCode Open Source Team

LiveCode on reddit: https://reddit.com/r/livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON library

2015-11-18 Thread Lyn Teyla
Ali Lloyd wrote:

> The JSON library is an extension and so you need to include it manually (at
> least at the moment) - you'll need to select com.livecode.library.json in
> the Copy Files pane of the standalone settings.


On a somewhat related note, how does one utilize this JSON library (and other 
libraries implemented as extensions) on LiveCode Server?

Lyn



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON library

2015-11-18 Thread Ali Lloyd
Hi Peter,
The JSON library is an extension and so you need to include it manually (at
least at the moment) - you'll need to select com.livecode.library.json in
the Copy Files pane of the standalone settings.

On Tue, Nov 17, 2015 at 10:55 PM Peter Haworth  wrote:

> A stack that works fine in the IDE does not work when I make a standalone
> from it.  In particular, clicking on a scrolling list doesn't have the
> desired effect.  I think it may be because I'm using the new JSONImport
> function in my selectionChanged handler.  It's part of the JSON library and
> perhaps the JSON library is not being included in the standalone.
>
> I used the default setting to search for inclusions initially.  When I try
> to include specific libraries, the JSON library is not listed as one of the
> options.
>
> The above is all pure guesswork of course but should the JSON library be
> listed as an inclusion option?
>
> Pete
> lcSQL Software 
> Home of lcStackBrowser  and
> SQLiteAdmin 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-21 Thread J. Landman Gay

On 8/21/2015 3:06 AM, Dave Cragg wrote:


Instead of removing the httpHeaders setting, what if you set it to
this?

set the httpHeaders to Content-Type:
application/x-www-form-urlencoded

This is normally the default for post, but if you had set it to
something else earlier, I was wondering whether the previous setting
was still being used.


So it turns out that was the answer. I'm very indebted to Charles for 
helping me, I never would have figured this out.


I had launched a new instance of LC 7.1 and it should have been using 
its default headers, so it seems that something has changed since 6.x. 
On the other hand, I did so much tinkering that application/json may 
have been retained from previous tests; I lost track.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-21 Thread Peter W A Wood

 On 21 Aug 2015, at 10:59, Peter W A Wood peterwaw...@gmail.com wrote:
 
 Jacque
 
 On 21 Aug 2015, at 10:13, J. Landman Gay jac...@hyperactivesw.com 
 mailto:jac...@hyperactivesw.com wrote:
 
 Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.
 
 Make a field with this in it:
 
   [{Meals:Yes,Purpose:Business}]
 
 Now put this into a button or card script:
 
 constant kServerURL = https://www.domain.com/results.php 
 https://www.domain.com/results.php  --### use a valid URL here
 
 
 command sendToServer
  if the version  7 then
put fld 1 into tData
put json= before tData
  else
put textEncode(fld 1,UTF8) into tData
put textEncode(json=,UTF8) before tData
  end if
  post tData to kServerURL
  put it into tResponse
  put the result into tErr
  breakpoint -- so you can see it
 end sendToServer
 
 If someone can test this against a simple echo PHP maybe it will tell us 
 something. The real server returns empty in LC 7 and OK in LC 6.
 
 This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
 there too.
 
 Peter
 

It also works on LiveCode 7.1 RC1 … which took me hours to download :-(

Regards

Peter

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-21 Thread Dave Cragg

 On 21 Aug 2015, at 02:27, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 On 8/20/2015 6:45 PM, Dave Cragg wrote:
 What happens if you remove the httpHeader setting and also UrlEncode
 tData?
 
 Still errors I'm afraid.

Instead of removing the httpHeaders setting, what if you set it to this?

set the httpHeaders to Content-Type:  application/x-www-form-urlencoded

This is normally the default for post, but if you had set it to something else 
earlier, I was wondering whether the previous setting was still being used.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-21 Thread Charles Warwick
HI Peter,

I did some testing with Jacque and found that her LC7 was sending the wrong 
content-type when posting to the PHP script.

In case anyone is interested:

It was using a content type of 'application/json’ which would have made sense 
if the PHP script was written to accept the json data directly.

However, it was expecting the POST data to be encoded in name/value format: 
variableA=valueAvariableB=valueB.

In this case, it required the json data stored in a variable called json:  i.e. 
 json=json data

Changing the headers as follows before the POST resolved the issue:

  set the httpHeaders to “content-type: application/x-www-form-urlencoded

As I mentioned to Jacque, the json data itself needs to be urlEncoded.

Cheers,

Charles

 On 21 Aug 2015, at 5:20 pm, Peter W A Wood peterwaw...@gmail.com wrote:
 
 
 On 21 Aug 2015, at 10:59, Peter W A Wood peterwaw...@gmail.com wrote:
 
 Jacque
 
 On 21 Aug 2015, at 10:13, J. Landman Gay jac...@hyperactivesw.com 
 mailto:jac...@hyperactivesw.com wrote:
 
 Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.
 
 Make a field with this in it:
 
  [{Meals:Yes,Purpose:Business}]
 
 Now put this into a button or card script:
 
 constant kServerURL = https://www.domain.com/results.php 
 https://www.domain.com/results.php  --### use a valid URL here
 
 
 command sendToServer
 if the version  7 then
   put fld 1 into tData
   put json= before tData
 else
   put textEncode(fld 1,UTF8) into tData
   put textEncode(json=,UTF8) before tData
 end if
 post tData to kServerURL
 put it into tResponse
 put the result into tErr
 breakpoint -- so you can see it
 end sendToServer
 
 If someone can test this against a simple echo PHP maybe it will tell us 
 something. The real server returns empty in LC 7 and OK in LC 6.
 
 This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
 there too.
 
 Peter
 
 
 It also works on LiveCode 7.1 RC1 … which took me hours to download :-(
 
 Regards
 
 Peter
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-21 Thread Peter W A Wood
Hi Charles

 On 21 Aug 2015, at 16:07, Charles Warwick char...@techstrategies.com.au 
 wrote:
 
 HI Peter,
 
 I did some testing with Jacque and found that her LC7 was sending the wrong 
 content-type when posting to the PHP script.
 
 In case anyone is interested:
 
 It was using a content type of 'application/json’ which would have made sense 
 if the PHP script was written to accept the json data directly.
 
 However, it was expecting the POST data to be encoded in name/value format: 
 variableA=valueAvariableB=valueB.
 
 In this case, it required the json data stored in a variable called json:  
 i.e.  json=json data
 
 Changing the headers as follows before the POST resolved the issue:
 
  set the httpHeaders to “content-type: application/x-www-form-urlencoded
 
 As I mentioned to Jacque, the json data itself needs to be urlEncoded.
 
 Cheers,
 
 Charles

Thanks for closing the loop. 

Cheers

Peter
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Charles Warwick
That script works here with HTTPS, I am guessing there is something else 
specific about the configuration.

 On 21 Aug 2015, at 1:23 pm, Peter W A Wood peterwaw...@gmail.com wrote:
 
 Jacque
 
 
 This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
 there too.
 
 Apart from the difference in LiveCode versions, there is one other difference 
 that may be significant. I am using HTTP on my machine not HTTPS. There have 
 been some bugs in LiveCode 7 HTTPS support. Is it possible for you to run 
 your test using HTTP to access your client’s server?
 
 Regards
 
 Peter
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay
Now I don't know what to try next. :( But I appreciate your help. This 
is a weird one.


Is your PHP script like the one Peter posted?

On 8/20/2015 10:30 PM, Charles Warwick wrote:

That script works here with HTTPS, I am guessing there is something else 
specific about the configuration.


On 21 Aug 2015, at 1:23 pm, Peter W A Wood peterwaw...@gmail.com wrote:

Jacque



This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
there too.


Apart from the difference in LiveCode versions, there is one other difference 
that may be significant. I am using HTTP on my machine not HTTPS. There have 
been some bugs in LiveCode 7 HTTPS support. Is it possible for you to run your 
test using HTTP to access your client’s server?

Regards

Peter

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 10:23 PM, Peter W A Wood wrote:

Jacque



This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if
it works there too.


Apart from the difference in LiveCode versions, there is one other
difference that may be significant. I am using HTTP on my machine not
HTTPS. There have been some bugs in LiveCode 7 HTTPS support. Is it
possible for you to run your test using HTTP to access your client’s
server?


I'd thought of that too. I'll ask the PHP guy to set up an http URL. The 
other difference is the UTF8 encoding, but it's my understanding that 
servers always expect to receive that.


Thanks very much to you and Charles for your tests. I agree with Charles 
that it may indicate there is something wrong with the PHP script. If I 
give him the simple echo script that you posted here, is that a good test?


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Peter W A Wood
Jacque

 On 21 Aug 2015, at 11:32, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 I'd thought of that too. I'll ask the PHP guy to set up an http URL.

I don’t think it is a problem with HTTPS. With Google and Stack overflow’s 
help, I found this website - http://httpbin.org - you can send a POST request 
to https://httpbin.org/post and it will return the POST data to you (in JSON). 
I ran your test against both the http:// and https:// URLs and both worked.

 The other difference is the UTF8 encoding, but it's my understanding that 
 servers always expect to receive that.

I don’t think that all servers expect to receive UTF-8. The character encoding 
can be specified in configuration files.

 Thanks very much to you and Charles for your tests. I agree with Charles that 
 it may indicate there is something wrong with the PHP script. If I give him 
 the simple echo script that you posted here, is that a good test?

It is possible but this may be more useful:

PHP:
?php 
  var_dump($_POST);
?

It will return the POST data received by PHP. For example:

LiveCode Message Box:

put textEncode({   quote  é  quote  : 1}, UTF-8) into tJSON
put json= before tJSON
post tJSON to URL http://localhost/jacque.php;
put textDecode(it, UTF-8)

This is what it returns:
array(1) {
  [json]=
  string(10) { é: 1}
}

Hope this helps.

Peter

PS I’m no PHP programmer.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Peter W A Wood
Jacque

 
 This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
 there too.

Apart from the difference in LiveCode versions, there is one other difference 
that may be significant. I am using HTTP on my machine not HTTPS. There have 
been some bugs in LiveCode 7 HTTPS support. Is it possible for you to run your 
test using HTTP to access your client’s server?

Regards

Peter

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding

 On 21 Aug 2015, at 10:58 am, Peter W A Wood peterwaw...@gmail.com wrote:
 
 put textEncode({   quote  é  quote  : 1}, UTF-8) into tJSON
 put json= before tJSON
 post URLEncode(tJSON) to URL http://Localhost/jacque.php 
 http://localhost/jacque.php
 put textDecode(it, UTF-8”)

You would want to urlEncode tJSON before you put json= before it so the = isn’t 
encoded.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding
Just before posting can you dump your tData variable into a binfile and send it 
to me. It's got to be something simple...

Sent from my iPhone

 On 21 Aug 2015, at 8:33 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Thanks, but still no go. I get the same errors.
 
 Is anyone posting from LC 7? I also just tried 7.1rc1 but it doesn't work 
 either.
 
 On 8/20/2015 5:04 PM, Monte Goulding wrote:
 Is your convertToJSON function returning UTF8? I’m not sure what LC 7 does 
 when it concatenates “json=“ to a UTF8 string. If for example that json= is 
 UTF16 and the rest of the data is UTF8 it’s not surprising the server is 
 freaking out. Try:
 
 put textEncode(“json=“,”UTF8”) before tData
 
 On 21 Aug 2015, at 7:53 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 I'm still struggling with this. I have a valid JSON string, verified by a 
 web-checking site and by the PHP developer. He wants me to POST it this way:
 
 json=JSON string
 
 It doesn't work. He says the server receives it but it is not passed to the 
 PHP script because the main parameter is empty. Here's what I do:
 
  set the httpHeaders to content-type: application/json
  put convertToJSON() into tData -- produces valid JSON
  put json= before tData
  post tData to kServerURL
 
 The result is empty. The developer has set up the PHP to return the values 
 back to me for testing, but it is also always empty. He says this means 
 there is no main parameter, but he also said adding json= to the front 
 would provide that, he will just grab the params from what follows.
 
 The URL is https if that matters. I have also tried URLEncoding the JSON 
 but it didn't help. I also tried removing the custom header.
 
 He pointed me to this web site: https://www.hurl.it/ When I set it to 
 send JSON and enter the same params there, it POSTs successfully to the 
 server.
 
 How would you POST a JSON string to a PHP script on a secure server?
 
 --
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your 
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 -- 
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding

 On 21 Aug 2015, at 9:25 am, Peter W A Wood peterwaw...@gmail.com wrote:
 
 You’re content is no longer valid JSON once you have inserted the “json=“ (at 
 the PHP developer’s request). There may be a conflict between the header and 
 the actual content. What happens if you remove the line setting the 
 httpHeaders?

That’s a good question. I can’t see anything wrong with the JSON itself after 
reviewing the file. Validates and formats fine in TextMate. Are you sure they 
want post and not get or put?
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 6:25 PM, Peter W A Wood wrote:


You’re content is no longer valid JSON once you have inserted the
“json=“ (at the PHP developer’s request). There may be a conflict
between the header and the actual content. What happens if you remove
the line setting the httpHeaders?


Thanks Peter. No change, it still fails. I think the PHP guy is 
stripping off the json= anyway and just grabbing the parameters. But 
it does work without the header in LC 6.


I may as well remove the header I suppose.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding

 On 21 Aug 2015, at 9:29 am, Monte Goulding mo...@sweattechnologies.com 
 wrote:
 
 That’s a good question. I can’t see anything wrong with the JSON itself after 
 reviewing the file. Validates and formats fine in TextMate. Are you sure they 
 want post and not get or put?

Hmm… I just remembered you said it works in 6 and not 7. Perhaps it’s not 
something simple after all but try not setting the header first...

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Charles Warwick
It will still be useful… what I want to look at is what headers are generated 
and whether or not the JSON is still correctly formatted.

With a copy of the script, I should be able to tell you what is causing it to 
break between the versions.

I have been posting JSON data to PHP in other applications with no problems, so 
it must be something specific to what you are trying to do.

 On 21 Aug 2015, at 11:35 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 On 8/20/2015 7:24 PM, Charles Warwick wrote:
 If you are still having issues with this, I am happy to run a packet
 capture against it if you give me a copy of the script…
 
 That way I can tell you what the exact difference is between what LC7
 and LC6 actually post to the server…
 
 Actually, now that I think of it, this probably will show a good deal of 
 difference because the LC 7 version will be UTF8 and the LC 6 version won't.
 
 Which might be the problem, but I don't know. Do you think this would still 
 be useful?
 
 -- 
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding
What happens if you comment out line 247 of revLibURL stack script? textEncode 
native here seems to be a rather dangerous thing to do…

 On 21 Aug 2015, at 9:45 am, Dave Cragg dcr...@lacscentre.co.uk wrote:
 
 
 On 21 Aug 2015, at 00:33, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 On 8/20/2015 6:25 PM, Peter W A Wood wrote:
 
 You’re content is no longer valid JSON once you have inserted the
 “json=“ (at the PHP developer’s request). There may be a conflict
 between the header and the actual content. What happens if you remove
 the line setting the httpHeaders?
 
 Thanks Peter. No change, it still fails. I think the PHP guy is stripping 
 off the json= anyway and just grabbing the parameters. But it does work 
 without the header in LC 6.
 
 What happens if you remove the httpHeader setting and also UrlEncode tData? 
 
 Dave
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Charles Warwick
Encoding the = would break the POST data, as it would no longer be assigned the 
json data itself as a POST variable….

you only want to url encode the contents of the json variable

 On 21 Aug 2015, at 11:17 am, Monte Goulding mo...@sweattechnologies.com 
 wrote:
 
 
 On 21 Aug 2015, at 10:58 am, Peter W A Wood peterwaw...@gmail.com wrote:
 
 put textEncode({   quote  é  quote  : 1}, UTF-8) into tJSON
 put json= before tJSON
 post URLEncode(tJSON) to URL http://Localhost/jacque.php 
 http://localhost/jacque.php
 put textDecode(it, UTF-8”)
 
 You would want to urlEncode tJSON before you put json= before it so the = 
 isn’t encoded.
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 8:46 PM, Charles Warwick wrote:

It will still be useful… what I want to look at is what headers are
generated and whether or not the JSON is still correctly formatted.

With a copy of the script, I should be able to tell you what is
causing it to break between the versions.

I have been posting JSON data to PHP in other applications with no
problems, so it must be something specific to what you are trying to
do.


Okay, thanks very much. I just sent a test script to the list that fails 
reproducibly. You'll need to put in a valid URL though, I can't really 
give out my client's.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Peter W A Wood
Jacque

 On 21 Aug 2015, at 10:13, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.
 
 Make a field with this in it:
 
   [{Meals:Yes,Purpose:Business}]
 
 Now put this into a button or card script:
 
 constant kServerURL = https://www.domain.com/results.php 
 https://www.domain.com/results.php  --### use a valid URL here
 
 
 command sendToServer
  if the version  7 then
put fld 1 into tData
put json= before tData
  else
put textEncode(fld 1,UTF8) into tData
put textEncode(json=,UTF8) before tData
  end if
  post tData to kServerURL
  put it into tResponse
  put the result into tErr
  breakpoint -- so you can see it
 end sendToServer
 
 If someone can test this against a simple echo PHP maybe it will tell us 
 something. The real server returns empty in LC 7 and OK in LC 6.

This works fine in LiveCode 7.0.3. I’ll download 7.1RC1 and see if it works 
there too.

Peter

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Charles Warwick
If you are still having issues with this, I am happy to run a packet capture 
against it if you give me a copy of the script… 

That way I can tell you what the exact difference is between what LC7 and LC6 
actually post to the server…

 On 21 Aug 2015, at 9:50 am, Monte Goulding mo...@sweattechnologies.com 
 wrote:
 
 What happens if you comment out line 247 of revLibURL stack script? 
 textEncode native here seems to be a rather dangerous thing to do…
 
 On 21 Aug 2015, at 9:45 am, Dave Cragg dcr...@lacscentre.co.uk wrote:
 
 
 On 21 Aug 2015, at 00:33, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 On 8/20/2015 6:25 PM, Peter W A Wood wrote:
 
 You’re content is no longer valid JSON once you have inserted the
 “json=“ (at the PHP developer’s request). There may be a conflict
 between the header and the actual content. What happens if you remove
 the line setting the httpHeaders?
 
 Thanks Peter. No change, it still fails. I think the PHP guy is stripping 
 off the json= anyway and just grabbing the parameters. But it does work 
 without the header in LC 6.
 
 What happens if you remove the httpHeader setting and also UrlEncode tData? 
 
 Dave
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 6:45 PM, Dave Cragg wrote:

What happens if you remove the httpHeader setting and also UrlEncode
tData?


Still errors I'm afraid.

Monte wrote:


What happens if you comment out line 247 of revLibURL stack script?
textEncode native here seems to be a rather dangerous thing to do…


Still errors.

Charles wrote:


If you are still having issues with this, I am happy to run a packet
capture against it if you give me a copy of the script…

That way I can tell you what the exact difference is between what
LC7 and LC6 actually post to the server…


That sounds useful. I probably won't understand it but someone else here
might. I'll write you privately if you don't mind. Thanks.

Peter wrote:


I’m not sure if you are URLEncoding the data … that certainly seems
to cause a problem


I'm not URLEncoding the data, though I did try it and it failed. I'm not 
good enough with PHP to even begin to reproduce your setup. I'm a 
one-trick LC pony.


I'm also running a low-grade fever and feel awful, so it's probably 
affecting my thought processes. But I thought I could just post and be 
done with it.


The next hurdle will be getting this to run on iOS which is the target 
platform. I haven't even gone there yet.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 7:24 PM, Charles Warwick wrote:

If you are still having issues with this, I am happy to run a packet
capture against it if you give me a copy of the script…

That way I can tell you what the exact difference is between what LC7
and LC6 actually post to the server…


Actually, now that I think of it, this probably will show a good deal of 
difference because the LC 7 version will be UTF8 and the LC 6 version won't.


Which might be the problem, but I don't know. Do you think this would 
still be useful?


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Charles Warwick
If I send that to a PHP script on one of my servers, I receive the JSON data 
correctly from LC7 in the PHP script.

I will just run it against LC6 and make sure it is identical.

If you want, you can post to my PHP script and then we can see how it compares 
between the two versions.  If it works there, it may be an issue with server 
you are posting to or the way that the PHP script is trying to read the data.  
Probably best if you send me a direct e-mail if you want to do that.



 On 21 Aug 2015, at 12:13 pm, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.
 
 Make a field with this in it:
 
   [{Meals:Yes,Purpose:Business}]
 
 Now put this into a button or card script:
 
 constant kServerURL = https://www.domain.com/results.php;  --### use a valid 
 URL here
 
 
 command sendToServer
  if the version  7 then
put fld 1 into tData
put json= before tData
  else
put textEncode(fld 1,UTF8) into tData
put textEncode(json=,UTF8) before tData
  end if
  post tData to kServerURL
  put it into tResponse
  put the result into tErr
  breakpoint -- so you can see it
 end sendToServer
 
 If someone can test this against a simple echo PHP maybe it will tell us 
 something. The real server returns empty in LC 7 and OK in LC 6.
 
 -- 
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Peter W A Wood
Jacque

 On 21 Aug 2015, at 05:53, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Here's what I do:
 
  set the httpHeaders to content-type: application/json
  put convertToJSON() into tData -- produces valid JSON
  put json= before tData
  post tData to kServerURL

You’re content is no longer valid JSON once you have inserted the “json=“ (at 
the PHP developer’s request). There may be a conflict between the header and 
the actual content. What happens if you remove the line setting the httpHeaders?

Regards

Peter

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Dave Cragg

 On 21 Aug 2015, at 00:33, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 On 8/20/2015 6:25 PM, Peter W A Wood wrote:
 
 You’re content is no longer valid JSON once you have inserted the
 “json=“ (at the PHP developer’s request). There may be a conflict
 between the header and the actual content. What happens if you remove
 the line setting the httpHeaders?
 
 Thanks Peter. No change, it still fails. I think the PHP guy is stripping off 
 the json= anyway and just grabbing the parameters. But it does work without 
 the header in LC 6.

What happens if you remove the httpHeader setting and also UrlEncode tData? 

Dave



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Peter W A Wood
Jacque

 On 21 Aug 2015, at 07:35, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Right. Works without header in 6, fails in 7. Thanks for looking at my file. 
 I wonder what would happen if I use the LC 6 libURL script in LC 7. Will my 
 unicode go all wonky? The file I sent you is in English but most of the time 
 it won't be.

I ran a very simple test using the message box and a very simple PHP script. I 
was able to post json={JSON} to PHP and get it back.

In the message box (using LC 7..0.3)

post textEncode(json={  quote  é  quote  : 1}, UTF-8) to  URL 
http://Localhost/jacque.php;
put textDecode(it, UTF-8”)

The PHP script:

?php 
  echo($_POST[json]);
?

The result in the message box:

{é: 1}

This would indicate your issue is not caused by a bug.

I’m not sure if you are URLEncoding the data … that certainly seems to cause a 
problem

Revised LiveCode
put textEncode({   quote  é  quote  : 1}, UTF-8) into tJSON
put json= before tJSON
post URLEncode(tJSON) to URL http://Localhost/jacque.php;
put textDecode(it, UTF-8”)

Result 
PHP sends back an empty response.

Hope this is of some help.

Peter
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

On 8/20/2015 6:32 PM, Monte Goulding wrote:



On 21 Aug 2015, at 9:29 am, Monte Goulding
mo...@sweattechnologies.com wrote:

That’s a good question. I can’t see anything wrong with the JSON
itself after reviewing the file. Validates and formats fine in
TextMate. Are you sure they want post and not get or put?


Hmm… I just remembered you said it works in 6 and not 7. Perhaps it’s
not something simple after all but try not setting the header
first...


Right. Works without header in 6, fails in 7. Thanks for looking at my 
file. I wonder what would happen if I use the LC 6 libURL script in LC 
7. Will my unicode go all wonky? The file I sent you is in English but 
most of the time it won't be.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.

Make a field with this in it:

   [{Meals:Yes,Purpose:Business}]

Now put this into a button or card script:

constant kServerURL = https://www.domain.com/results.php;  --### use a 
valid URL here



command sendToServer
  if the version  7 then
put fld 1 into tData
put json= before tData
  else
put textEncode(fld 1,UTF8) into tData
put textEncode(json=,UTF8) before tData
  end if
  post tData to kServerURL
  put it into tResponse
  put the result into tErr
  breakpoint -- so you can see it
end sendToServer

If someone can test this against a simple echo PHP maybe it will tell us 
something. The real server returns empty in LC 7 and OK in LC 6.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay
I'm still struggling with this. I have a valid JSON string, verified by 
a web-checking site and by the PHP developer. He wants me to POST it 
this way:


json=JSON string

It doesn't work. He says the server receives it but it is not passed to 
the PHP script because the main parameter is empty. Here's what I do:


  set the httpHeaders to content-type: application/json
  put convertToJSON() into tData -- produces valid JSON
  put json= before tData
  post tData to kServerURL

The result is empty. The developer has set up the PHP to return the 
values back to me for testing, but it is also always empty. He says 
this means there is no main parameter, but he also said adding json= 
to the front would provide that, he will just grab the params from what 
follows.


The URL is https if that matters. I have also tried URLEncoding the JSON 
but it didn't help. I also tried removing the custom header.


He pointed me to this web site: https://www.hurl.it/ When I set it to 
send JSON and enter the same params there, it POSTs successfully to the 
server.


How would you POST a JSON string to a PHP script on a secure server?

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread Monte Goulding
Is your convertToJSON function returning UTF8? I’m not sure what LC 7 does when 
it concatenates “json=“ to a UTF8 string. If for example that json= is UTF16 
and the rest of the data is UTF8 it’s not surprising the server is freaking 
out. Try:

put textEncode(“json=“,”UTF8”) before tData

 On 21 Aug 2015, at 7:53 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 I'm still struggling with this. I have a valid JSON string, verified by a 
 web-checking site and by the PHP developer. He wants me to POST it this way:
 
 json=JSON string
 
 It doesn't work. He says the server receives it but it is not passed to the 
 PHP script because the main parameter is empty. Here's what I do:
 
  set the httpHeaders to content-type: application/json
  put convertToJSON() into tData -- produces valid JSON
  put json= before tData
  post tData to kServerURL
 
 The result is empty. The developer has set up the PHP to return the values 
 back to me for testing, but it is also always empty. He says this means 
 there is no main parameter, but he also said adding json= to the front 
 would provide that, he will just grab the params from what follows.
 
 The URL is https if that matters. I have also tried URLEncoding the JSON but 
 it didn't help. I also tried removing the custom header.
 
 He pointed me to this web site: https://www.hurl.it/ When I set it to send 
 JSON and enter the same params there, it POSTs successfully to the server.
 
 How would you POST a JSON string to a PHP script on a secure server?
 
 -- 
 Jacqueline Landman Gay | jac...@hyperactivesw.com
 HyperActive Software   | http://www.hyperactivesw.com
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

Okay, addendum: It works fine in LC 6.7.6. It fails entirely in 7.0.6.

I wish I'd tried that sooner. We need 7.x because of the unicode support.


On 8/20/2015 4:53 PM, J. Landman Gay wrote:

I'm still struggling with this. I have a valid JSON string, verified by
a web-checking site and by the PHP developer. He wants me to POST it
this way:

json=JSON string

It doesn't work. He says the server receives it but it is not passed to
the PHP script because the main parameter is empty. Here's what I do:

   set the httpHeaders to content-type: application/json
   put convertToJSON() into tData -- produces valid JSON
   put json= before tData
   post tData to kServerURL

The result is empty. The developer has set up the PHP to return the
values back to me for testing, but it is also always empty. He says
this means there is no main parameter, but he also said adding json=
to the front would provide that, he will just grab the params from what
follows.

The URL is https if that matters. I have also tried URLEncoding the JSON
but it didn't help. I also tried removing the custom header.

He pointed me to this web site: https://www.hurl.it/ When I set it to
send JSON and enter the same params there, it POSTs successfully to the
server.

How would you POST a JSON string to a PHP script on a secure server?




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-20 Thread J. Landman Gay

Thanks, but still no go. I get the same errors.

Is anyone posting from LC 7? I also just tried 7.1rc1 but it doesn't 
work either.


On 8/20/2015 5:04 PM, Monte Goulding wrote:

Is your convertToJSON function returning UTF8? I’m not sure what LC 7 does when 
it concatenates “json=“ to a UTF8 string. If for example that json= is UTF16 
and the rest of the data is UTF8 it’s not surprising the server is freaking 
out. Try:

put textEncode(“json=“,”UTF8”) before tData


On 21 Aug 2015, at 7:53 am, J. Landman Gay jac...@hyperactivesw.com wrote:

I'm still struggling with this. I have a valid JSON string, verified by a 
web-checking site and by the PHP developer. He wants me to POST it this way:

json=JSON string

It doesn't work. He says the server receives it but it is not passed to the PHP 
script because the main parameter is empty. Here's what I do:

  set the httpHeaders to content-type: application/json
  put convertToJSON() into tData -- produces valid JSON
  put json= before tData
  post tData to kServerURL

The result is empty. The developer has set up the PHP to return the values back to me for testing, but 
it is also always empty. He says this means there is no main parameter, but he also 
said adding json= to the front would provide that, he will just grab the params from what follows.

The URL is https if that matters. I have also tried URLEncoding the JSON but it 
didn't help. I also tried removing the custom header.

He pointed me to this web site: https://www.hurl.it/ When I set it to send 
JSON and enter the same params there, it POSTs successfully to the server.

How would you POST a JSON string to a PHP script on a secure server?

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-17 Thread Monte Goulding

 On 18 Aug 2015, at 6:54 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 Thanks Monte. The JSON is created by EasyJSON from a LC array. Most of the 
 values in the array are in foreign languages with lots of non-ascii 
 characters, and those will become the values in the parameter string that I 
 will send in a POST. It doesn't look like EasyJSON does any UTF8 encoding 
 when creating the JSON.

I haven’t used EasyJSON because it was done after mergJSON so I can’t confirm 
about the utf8. If you are posting JSON then you don’t need to urlEncode. Just 
set the content type header to application/json
 
 So I guess I need to UTF8 encode the array before sending it to the JSON 
 parser, then URL-encode the JSON. Is it possible to textEncode a whole array 
 at once without looping through all the elements?

No, just UTF8 encode any elements (or keys) that’s not likely to be ASCII.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON, URL-encode, and UTF-8

2015-08-17 Thread Monte Goulding
I think we would need to see the API to know about the urlEncoding. Is it a 
parameter in your query string? If you need to urlEncode it will be the last 
thing you do. If you are using one of the script libraries the UTF8 encoding 
may be done for you. If you are using mergJSON then UTF8 encode anything that's 
not ASCII before you JSON encode.

Cheers

Monte

Sent from my iPhone

 On 18 Aug 2015, at 4:41 am, J. Landman Gay jac...@hyperactivesw.com wrote:
 
 I've confused myself. I need to send JSON to a server. The values will have 
 foreign characters in them. So I think I need to use textEncode to convert it 
 to UTF8 and also it needs to be URL encoded. Is that right? And if so, what 
 order do I do it in?
 
 Do I URL-encode each value in the array, then create the JSON, then 
 textEncode that? Or some other order? Or does textEncoding remove the need to 
 URL encode?

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON, URL-encode, and UTF-8

2015-08-17 Thread J. Landman Gay
Thanks Monte. The JSON is created by EasyJSON from a LC array. Most of 
the values in the array are in foreign languages with lots of non-ascii 
characters, and those will become the values in the parameter string 
that I will send in a POST. It doesn't look like EasyJSON does any UTF8 
encoding when creating the JSON.


So I guess I need to UTF8 encode the array before sending it to the JSON 
parser, then URL-encode the JSON. Is it possible to textEncode a whole 
array at once without looping through all the elements?



On 8/17/2015 3:28 PM, Monte Goulding wrote:

I think we would need to see the API to know about the urlEncoding.
Is it a parameter in your query string? If you need to urlEncode it
will be the last thing you do. If you are using one of the script
libraries the UTF8 encoding may be done for you. If you are using
mergJSON then UTF8 encode anything that's not ASCII before you JSON
encode.

Cheers

Monte

Sent from my iPhone


On 18 Aug 2015, at 4:41 am, J. Landman Gay
jac...@hyperactivesw.com wrote:

I've confused myself. I need to send JSON to a server. The values
will have foreign characters in them. So I think I need to use
textEncode to convert it to UTF8 and also it needs to be URL
encoded. Is that right? And if so, what order do I do it in?

Do I URL-encode each value in the array, then create the JSON, then
textEncode that? Or some other order? Or does textEncoding remove
the need to URL encode?


___ use-livecode mailing
list use-livecode@lists.runrev.com Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON Safe Text

2015-07-24 Thread David Bovill
Yes - it's taken from the wild (an HTML page on the internet). Then turned
into XML, then a table extracted etc - so looks to me like non-utf8 stuff
has go in there somewhere.

That's why I was wandering if there was a way to filter out arbitrary text
and make it utf8-safe. You know urlencode for utf8 - or plain text? I don't
want to encode all the spaces and normal / safe chars - just whatever weird
stuff got into the data?

On 24 July 2015 at 00:12, Monte Goulding mo...@sweattechnologies.com
wrote:


  On 24 Jul 2015, at 7:22 am, David Bovill david@viral.academy wrote:
 
  I'm placing the text into an array and then using Monte's mergJsonEncode
  function to decode it. Usually works fine - but in this case it looks
 like
  the content needs some tidying before I put it into the array.

 mergJSON will choke on anything that’s not utf8. Is it possible there’s
 some other encoded data there or something you are doing with the data is
 messing with the encoding?

 --
 M E R Goulding http://goulding.ws/
 Software development services
 Bespoke application development for vertical markets

 mergExt http://mergext.com/ - There's an external for that!

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON Safe Text

2015-07-24 Thread Monte Goulding
You really need to know the encoding you are working with. Check if the page 
has a charset attribute first and if it does re-encode to utf8 first. The try 
it in mergJSON. If it chokes then the best you can do is replace any char 
greater than charToNum(127) with “?”. Other than that I think there are 
encoding detectors around but it may depend on how critical the data is...

 On 24 Jul 2015, at 4:03 pm, David Bovill david@viral.academy wrote:
 
 Yes - it's taken from the wild (an HTML page on the internet). Then turned
 into XML, then a table extracted etc - so looks to me like non-utf8 stuff
 has go in there somewhere.
 
 That's why I was wandering if there was a way to filter out arbitrary text
 and make it utf8-safe. You know urlencode for utf8 - or plain text? I don't
 want to encode all the spaces and normal / safe chars - just whatever weird
 stuff got into the data?
 
 On 24 July 2015 at 00:12, Monte Goulding mo...@sweattechnologies.com
 wrote:
 
 
 On 24 Jul 2015, at 7:22 am, David Bovill david@viral.academy wrote:
 
 I'm placing the text into an array and then using Monte's mergJsonEncode
 function to decode it. Usually works fine - but in this case it looks
 like
 the content needs some tidying before I put it into the array.
 
 mergJSON will choke on anything that’s not utf8. Is it possible there’s
 some other encoded data there or something you are doing with the data is
 messing with the encoding?
 
 --
 M E R Goulding http://goulding.ws/
 Software development services
 Bespoke application development for vertical markets
 
 mergExt http://mergext.com/ - There's an external for that!
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

--
M E R Goulding http://goulding.ws/ 
Software development services
Bespoke application development for vertical markets

mergExt http://mergext.com/ - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON Safe Text

2015-07-23 Thread Monte Goulding

 On 24 Jul 2015, at 7:22 am, David Bovill david@viral.academy wrote:
 
 I'm placing the text into an array and then using Monte's mergJsonEncode
 function to decode it. Usually works fine - but in this case it looks like
 the content needs some tidying before I put it into the array.

mergJSON will choke on anything that’s not utf8. Is it possible there’s some 
other encoded data there or something you are doing with the data is messing 
with the encoding?

--
M E R Goulding http://goulding.ws/ 
Software development services
Bespoke application development for vertical markets

mergExt http://mergext.com/ - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: JSON parser discovery

2015-07-21 Thread Jim Lambert
MarkW wrote:
 json_pp  filename

Mark,

Very handy. Fast too.
Thanks!

Jim Lambert

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-05 Thread Igor de Oliveira Couto
Sorry to come so late to this thread. 

It's nice to see that my little JSON library is being used. I wanted to let 
everyone know, that Monte's library is much faster and more efficient than the 
LiveCode-native solutions, like mine. I wholeheartedly recommend it. There are 
occasions, however, when a programmer may not be able to - or want to - use 
externals, so these native libraries can still come in handy.

I saw that someone wanted to add features to a native JSON library - for 
instance, forcing the parser to recognise a certain value as a string rather 
than a number. I kindly ask you to consider using the EasyJSON library as a 
base, and contributing back your enhancements to the code. EasyJSON is hosted 
here:

https://github.com/luxlogica/easyjson

I tried to take great care to thoroughly document the code, so that it would be 
easier for others to understand, debug and enhance later. EasyJSON has also 
been released into the public domain, meaning that it can be safely used in 
both Open Source and closed-source commercial projects.

And while you're there, you may want to check out another script I've released 
'into the wild': EasyLocalNumber:

https://github.com/luxlogica/easylocalnumber

This is a behaviour script that makes it relatively painless to create 
localised numeric fields - ie., enabling the user to enter numbers with 
customised decimal and thousands separators, and currency symbols. Any 
enhancements and bug-fixes there would be most welcome! :-)

Kindest regards to all,


--
Igor Couto
Sydney, Australia


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Richard Gaskin

Mark Wieder wrote:

Well, what you want to push to the server depends on the key:value
pairs they expect. Here's a simple example:

{name : Tom McGrath, favorite_author : Dr. Seuss}

Here's an example from a mongodb student database:

{_id: {oid : 1234},
  student_id : 0,
  class_id : 49,
  scores : [
{type : exam, score : 54.6}
{type : quiz, score : 65.6}
{type : homework, score : 78}
{type : homework, score : 80.4}
  ]
}


JSON is a good argument for what I like to call LSON, where the L 
stands for LiveCode of course. :)


Similar to MongoDB's BSON, LSON is a very convenient way to move 
hierarchically-ordered data back and forth between sever and client, 
compressing arrays and then Base64'ing them for efficient, robust 
network transport:


function ArrayToLSON pArray
put arrayEncode(pArray) into tData
put compress(tData) into tData
return base64Encode(tData)
end ArrayToLSON

function LSONToArray pData
  try
put base64Decode(pData) into tData
put decompress(tData) into tData
put arrayDecode(tData) into tArray
  catch tErr
throw Error unpacking LSON data
  end try
  return tArray
end LSONToArray

My understanding is that LC's RevOnline uses that format, and I believe 
Andre is fond of it too.


Of course this only works if you have LC on both ends of the 
client-server setup, but who doesn't? :)


--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  http://twitter.com/FourthWorldSys

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Thomas McGrath III
Monte, Are you saying that array's are not supported on iOS or are you saying 
that mergJSON is not supported on iOS? This is needed from an iOS app to send 
the data to my server from the app.

Tom

-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com

On Jun 3, 2013, at 10:32 PM, Monte Goulding mo...@sweattechnologies.com wrote:

 Unfortunately as there's no array support for iOS externals I can't implement 
 mergJSON there...

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Andrew Kluthe
mergJSON i do believe. arrays not being supported on iOS would come as kind
of a shock to me.


On Tue, Jun 4, 2013 at 4:17 PM, Thomas McGrath III mcgra...@mac.com wrote:

 Monte, Are you saying that array's are not supported on iOS or are you
 saying that mergJSON is not supported on iOS? This is needed from an iOS
 app to send the data to my server from the app.

 Tom

 -- Tom McGrath III
 http://lazyriver.on-rev.com
 mcgra...@mac.com

 On Jun 3, 2013, at 10:32 PM, Monte Goulding mo...@sweattechnologies.com
 wrote:

  Unfortunately as there's no array support for iOS externals I can't
 implement mergJSON there...

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread J. Landman Gay

On 6/4/13 4:17 PM, Thomas McGrath III wrote:

Monte, Are you saying that array's are not supported on iOS or are
you saying that mergJSON is not supported on iOS? This is needed from
an iOS app to send the data to my server from the app.


If Monte's external doesn't work out, there are several script-based 
solutions.


Igor de Oliveira Couto:
https://github.com/luxlogica/easyjson/blob/master/easyjson.lc

Andre Garzia:
http://andregarzia.com/stacks/lib.aag.json.livecode

Mark Smith:
http://revonline2.runrev.com/stack/82/LibJson-1-0b

Igor's is a newer update based on the other two, and in my tests it 
worked very well. You don't need to know JSON to use it. We eventually 
decided to go with plain text in my project, but I'd settled on Igor's 
library before we changed our minds.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding

On 05/06/2013, at 7:17 AM, Thomas McGrath III mcgra...@mac.com wrote:

 Monte, Are you saying that array's are not supported on iOS or are you saying 
 that mergJSON is not supported on iOS? This is needed from an iOS app to send 
 the data to my server from the app.

Arrays are not yet supported in iOS externals (it's all ifdefed out), however, 
it looks like I should be able to use the old externals sdk to compile for 
iOS... and possibly android if the external doesn't need any native features. 
Unlike most of my mergExt stuff mergJSON uses a cross platform C library and is 
a good candidate for that. However, this is probably going to be well down my 
priority list given I've only had one person interested in buying it and I 
don't currently need it on mobile...

--
Monte Goulding

M E R Goulding - software development services
mergExt - There's an external for that!





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Thomas McGrath III
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:i...@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.



-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding
Are device_type and dentist_id meant to be strings or integers?

On 05/06/2013, at 7:55 AM, Thomas McGrath III mcgra...@mac.com 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:i...@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.
 
 
 
 -- Tom McGrath III
 http://lazyriver.on-rev.com
 mcgra...@mac.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

--
Monte Goulding

M E R Goulding - software development services
mergExt - There's an external for that!





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Thomas McGrath III
I don't know Monte, I will try and find out. But the info below is what was 
sent in the test using a restful client by the developer of the api.


-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com

On Jun 4, 2013, at 6:07 PM, Monte Goulding mo...@sweattechnologies.com wrote:

 Are device_type and dentist_id meant to be strings or integers?
 
 On 05/06/2013, at 7:55 AM, Thomas McGrath III mcgra...@mac.com 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:i...@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.
 
 
 
 -- Tom McGrath III
 http://lazyriver.on-rev.com
 mcgra...@mac.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 --
 Monte Goulding
 
 M E R Goulding - software development services
 mergExt - There's an external for that!
 
 
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread J. Landman Gay

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:i...@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 i...@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 | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding

On 05/06/2013, at 8:16 AM, Thomas McGrath III wrote:

 I don't know Monte, I will try and find out. But the info below is what was 
 sent in the test using a restful client by the developer of the api.

strings then

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding

On 05/06/2013, at 8:57 AM, J. Landman Gay wrote:

 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 i...@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.

Ah... how is that library working out if something is a number or a string? If 
it's doing it's just using is a number then given you have numbers that you 
need to send as strings you're going to have a problem. You might need to look 
at the api and find out if it has a way to force elements to be a string. 
Alternatively... seeing as it's really not a big document and you don't need to 
do JSONToArray you could just put a template in a custom property and use 
merge...

Cheers

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Andrew Kluthe
I dont know about the libraries he is using, but if it is based at all on
the late mark smiths's the numbers in his array would translate to integers
in terms of the json it spits out. I actually had to modify the output of
the mark smith library to place 0's before decimal points to avoid bad
request errors.

{
  data: {
appuser_details: {
  name: Tom_iPad,
  email: i...@gmail.com,
  device_type: 2,
  dentist_id: 73,
  device_token:
98be5c7a3cc9e400ae6a90977ac6d64f498bb01cbe83c3c3d1bb4856de59ba1c
}
  }
}

Also doing something like

set the httpHeaders to Content-Type: application/json

could help if you aren't doing this already.

Hmm, I wonder why your back end developer would be looking to use strings
in the place of integers. I


On Tue, Jun 4, 2013 at 6:13 PM, Monte Goulding
mo...@sweattechnologies.comwrote:


 On 05/06/2013, at 8:57 AM, J. Landman Gay wrote:

  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 i...@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.

 Ah... how is that library working out if something is a number or a
 string? If it's doing it's just using is a number then given you have
 numbers that you need to send as strings you're going to have a problem.
 You might need to look at the api and find out if it has a way to force
 elements to be a string. Alternatively... seeing as it's really not a big
 document and you don't need to do JSONToArray you could just put a template
 in a custom property and use merge...

 Cheers

 --
 M E R Goulding
 Software development services
 Bespoke application development for vertical markets

 mergExt - There's an external for that!

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding

On 05/06/2013, at 9:40 AM, Andrew Kluthe wrote:

 Hmm, I wonder why your back end developer would be looking to use strings
 in the place of integers

Well... they look like numbers in the sample data we have but they might not 
always be numbers. It's risky just assuming if an element is a number that it 
should be JSON encoded as a number... LiveCode might not care but the thing on 
the other end more than likely will break if it doesn't get the right type. 
mergJSON does this by allowing you to force elements as strings and also to 
pre-parse the array to ensure things are encoded correctly... things like an 
empty element might be meant to be an empty JSON object or array.

Cheers

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Andrew Kluthe
Good point. Handy feature. I might have to see if that can replace my
modified mark smith lib in some of my projects. Is mergJSON dual licensed?


On Tue, Jun 4, 2013 at 6:58 PM, Monte Goulding
mo...@sweattechnologies.comwrote:


 On 05/06/2013, at 9:40 AM, Andrew Kluthe wrote:

  Hmm, I wonder why your back end developer would be looking to use strings
  in the place of integers

 Well... they look like numbers in the sample data we have but they might
 not always be numbers. It's risky just assuming if an element is a number
 that it should be JSON encoded as a number... LiveCode might not care but
 the thing on the other end more than likely will break if it doesn't get
 the right type. mergJSON does this by allowing you to force elements as
 strings and also to pre-parse the array to ensure things are encoded
 correctly... things like an empty element might be meant to be an empty
 JSON object or array.

 Cheers

 --
 M E R Goulding
 Software development services
 Bespoke application development for vertical markets

 mergExt - There's an external for that!

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Monte Goulding

On 05/06/2013, at 11:08 AM, Andrew Kluthe wrote:

 Good point. Handy feature. I might have to see if that can replace my
 modified mark smith lib in some of my projects. Is mergJSON dual licensed?

That's the intention but as there hasn't been a rush to buy (I did expect that 
given there's LC only options) I haven't added it yet as an option to buy on 
mergExt.com I'm still working out exactly what I should deliver as the 
commercial version... I'm thinking that just the license file naming the 
current version is all that's required. BTW it will be $49 individually and 
also bundled with mergExt.

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Thomas McGrath III
Andrew, That did it. I had the headers wrong.

  set the httpHeaders to Content-Type: application/json

worked and not set the httpHeaders to text/json did not.

It actually worked. THanks to everyone who helped me out.

Tom

-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com

On Jun 4, 2013, at 7:40 PM, Andrew Kluthe and...@ctech.me wrote:

 I dont know about the libraries he is using, but if it is based at all on
 the late mark smiths's the numbers in his array would translate to integers
 in terms of the json it spits out. I actually had to modify the output of
 the mark smith library to place 0's before decimal points to avoid bad
 request errors.
 
 {
  data: {
appuser_details: {
  name: Tom_iPad,
  email: i...@gmail.com,
  device_type: 2,
  dentist_id: 73,
  device_token:
 98be5c7a3cc9e400ae6a90977ac6d64f498bb01cbe83c3c3d1bb4856de59ba1c
}
  }
 }
 
 Also doing something like
 
 set the httpHeaders to Content-Type: application/json
 
 could help if you aren't doing this already.
 
 Hmm, I wonder why your back end developer would be looking to use strings
 in the place of integers. I
 
 
 On Tue, Jun 4, 2013 at 6:13 PM, Monte Goulding
 mo...@sweattechnologies.comwrote:
 
 
 On 05/06/2013, at 8:57 AM, J. Landman Gay wrote:
 
 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 i...@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.
 
 Ah... how is that library working out if something is a number or a
 string? If it's doing it's just using is a number then given you have
 numbers that you need to send as strings you're going to have a problem.
 You might need to look at the api and find out if it has a way to force
 elements to be a string. Alternatively... seeing as it's really not a big
 document and you don't need to do JSONToArray you could just put a template
 in a custom property and use merge...
 
 Cheers
 
 --
 M E R Goulding
 Software development services
 Bespoke application development for vertical markets
 
 mergExt - There's an external for that!
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 
 -- 
 Regards,
 
 Andrew Kluthe
 and...@ctech.me
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-04 Thread Andrew Kluthe
Nice. glad to hear that!


On Tue, Jun 4, 2013 at 8:33 PM, Thomas McGrath III mcgra...@mac.com wrote:

 Andrew, That did it. I had the headers wrong.

   set the httpHeaders to Content-Type: application/json

 worked and not set the httpHeaders to text/json did not.

 It actually worked. THanks to everyone who helped me out.

 Tom

 -- Tom McGrath III
 http://lazyriver.on-rev.com
 mcgra...@mac.com

 On Jun 4, 2013, at 7:40 PM, Andrew Kluthe and...@ctech.me wrote:

  I dont know about the libraries he is using, but if it is based at all on
  the late mark smiths's the numbers in his array would translate to
 integers
  in terms of the json it spits out. I actually had to modify the output of
  the mark smith library to place 0's before decimal points to avoid bad
  request errors.
 
  {
   data: {
 appuser_details: {
   name: Tom_iPad,
   email: i...@gmail.com,
   device_type: 2,
   dentist_id: 73,
   device_token:
  98be5c7a3cc9e400ae6a90977ac6d64f498bb01cbe83c3c3d1bb4856de59ba1c
 }
   }
  }
 
  Also doing something like
 
  set the httpHeaders to Content-Type: application/json
 
  could help if you aren't doing this already.
 
  Hmm, I wonder why your back end developer would be looking to use strings
  in the place of integers. I
 
 
  On Tue, Jun 4, 2013 at 6:13 PM, Monte Goulding
  mo...@sweattechnologies.comwrote:
 
 
  On 05/06/2013, at 8:57 AM, J. Landman Gay wrote:
 
  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 i...@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.
 
  Ah... how is that library working out if something is a number or a
  string? If it's doing it's just using is a number then given you have
  numbers that you need to send as strings you're going to have a problem.
  You might need to look at the api and find out if it has a way to force
  elements to be a string. Alternatively... seeing as it's really not a
 big
  document and you don't need to do JSONToArray you could just put a
 template
  in a custom property and use merge...
 
  Cheers
 
  --
  M E R Goulding
  Software development services
  Bespoke application development for vertical markets
 
  mergExt - There's an external for that!
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
  subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 
  --
  Regards,
 
  Andrew Kluthe
  and...@ctech.me
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Mark Schonewille

Hi Tom,

If you don't need to send any binary data (that includes unicode text) 
then you have no need for JSON (or XML for that matter). You'll need to 
make sure that everybody understands what type of data you're going to 
use, though, and what the record and item delimiters are.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com


Buy my new book Programming LiveCode for the Real Beginner 
http://qery.us/3fi


On 6/3/2013 22:37, Thomas McGrath III wrote:

OK, So I have some developers creating a server solution for my Push needs and they 
wanted me to send them JSON posts but I had never done that before and asked here on the 
list a few days ago about the JSON library. Well they said they can now remove the need 
for JSON and provide me a new API for simple form data BUT the question I have is 
Is it better to go the JSON route from within a Livecode Mobile app or should I go 
for the easy way out and have them change the API?

I don't mind learning something new but since it was new to me I didn't want to 
spend the time at first but now I am second guessing.

Any advice???

Thanks

Tom



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Thomas McGrath III
Thanks Mark, That's just the kind of advice I was looking for.

Tom


-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com

On Jun 3, 2013, at 4:54 PM, Mark Schonewille m.schonewi...@economy-x-talk.com 
wrote:

 Hi Tom,
 
 If you don't need to send any binary data (that includes unicode text) then 
 you have no need for JSON (or XML for that matter). You'll need to make sure 
 that everybody understands what type of data you're going to use, though, and 
 what the record and item delimiters are.
 
 --
 Best regards,
 
 Mark Schonewille
 
 Economy-x-Talk Consulting and Software Engineering
 Homepage: http://economy-x-talk.com
 Twitter: http://twitter.com/xtalkprogrammer
 KvK: 50277553
 
 Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour 
 spaces. http://www.color-converter.com
 
 Buy my new book Programming LiveCode for the Real Beginner 
 http://qery.us/3fi
 
 On 6/3/2013 22:37, Thomas McGrath III wrote:
 OK, So I have some developers creating a server solution for my Push needs 
 and they wanted me to send them JSON posts but I had never done that before 
 and asked here on the list a few days ago about the JSON library. Well they 
 said they can now remove the need for JSON and provide me a new API for 
 simple form data BUT the question I have is Is it better to go the JSON 
 route from within a Livecode Mobile app or should I go for the easy way out 
 and have them change the API?
 
 I don't mind learning something new but since it was new to me I didn't want 
 to spend the time at first but now I am second guessing.
 
 Any advice???
 
 Thanks
 
 Tom
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Mark Wieder
Thomas McGrath III mcgrath3@... writes:

 have is Is it better to go the JSON route from within a Livecode Mobile
app or should I go for the easy way out

Is this a trick question? The easy way out is *always* better g.

Do you have a lot of data to push? Any binary data? Do you need to receive
JSON data as well? JSON is just a formatted collection of key:value pairs.
Lots of nested curly braces and not particularly human-readable, but
generating JSON data is fairly easy. Parsing it is a little trickier.

-- 
 Mark Wieder
 mwie...@ahsoftware.net



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Thomas McGrath III
Mark,

The data is very simple with no binary at all. I won't need to receive any 
back. So…

-- Tom McGrath III
http://lazyriver.on-rev.com
mcgra...@mac.com

On Jun 3, 2013, at 6:20 PM, Mark Wieder mwie...@ahsoftware.net wrote:

 Thomas McGrath III mcgrath3@... writes:
 
 have is Is it better to go the JSON route from within a Livecode Mobile
 app or should I go for the easy way out
 
 Is this a trick question? The easy way out is *always* better g.
 
 Do you have a lot of data to push? Any binary data? Do you need to receive
 JSON data as well? JSON is just a formatted collection of key:value pairs.
 Lots of nested curly braces and not particularly human-readable, but
 generating JSON data is fairly easy. Parsing it is a little trickier.
 
 -- 
 Mark Wieder
 mwie...@ahsoftware.net
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Monte Goulding

On 04/06/2013, at 12:14 PM, Thomas McGrath III wrote:

 The data is very simple with no binary at all. I won't need to receive any 
 back. So…

Tom... JSON is no more complicated to write or difficult to read than a query 
string... If you are comfortable with one or the other then use that... 

BTW JSON has nothing to do with binary data... you would need to base64Encode 
it or something if you had binary data which you don't.

Unfortunately as there's no array support for iOS externals I can't implement 
mergJSON there... although I have been wondering if I could hack the desktop 
sdk to work on mobile just like I did to get the iOS one to work on OS X...

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-06-03 Thread Mark Wieder
Tom-

Monday, June 3, 2013, 7:14:37 PM, you wrote:

 Mark,

 The data is very simple with no binary at all. I won't need to receive any 
 back. So…

Well, what you want to push to the server depends on the key:value
pairs they expect. Here's a simple example:

{name : Tom McGrath, favorite_author : Dr. Seuss}

Here's an example from a mongodb student database:

{_id: {oid : 1234},
  student_id : 0,
  class_id : 49,
  scores : [
{type : exam, score : 54.6}
{type : quiz, score : 65.6}
{type : homework, score : 78}
{type : homework, score : 80.4}
  ]
}

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-05-28 Thread Mark Wieder
What Andrew said. I do the same using post, and it's pretty painless
and the key-value pairs are more readable than xml if you can handle
all the braces.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-05-23 Thread Richard Gaskin

Thomas McGrath III wrote:

 I have a server project where I need to send some JSON to a URL.
 I've never done this before. Has anyone got a simple
 example/explanation of how this is achieved?

I had to do that for a project recently, and I just sent the JSON to the 
server as the data in a POST command.  Worked a treat with the server I 
was sending to.


Have you tried POST?  Did you encounter any issues with it?

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  http://twitter.com/FourthWorldSys


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-05-23 Thread Monte Goulding
Take a look at JSON.org for the file format. I have a desktop/server external 
that does ArrayToJSON and visa versa if that helps. It's utf8 only. It's 
currently GPL licensed and I intend to do a commercial license when someone 
wants one ;-)

--
M E R Goulding
Software development services

mergExt - There's an external for that!

On 24/05/2013, at 5:45 AM, Thomas McGrath III mcgra...@mac.com wrote:

 I have a server project where I need to send some JSON to a URL. I've never 
 done this before. Has anyone got a simple example/explanation of how this is 
 achieved?
 
 Thanks in advance.
 
 Tom
 
 -- Tom McGrath III
 http://lazyriver.on-rev.com
 mcgra...@mac.com
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-05-23 Thread Andrew Kluthe
I do this a lot in my work. Generally it is up to how the server wants
to receive the JSON. There are several ways to do it depending on the verb
the server side is looking for. Is this for some kind of public API or do
you have any information on the API you are trying to work with?

Usually I just put whatever JSON I am looking for into a variable and
simply  post theOjbectVariable to URL (theEndpointURL) 

You can also use put instead of post to get the http PUT verb. Some API's
provide a hacky way to use PATCH verbs as well by specifying the verb in
the header.

Andrew


On Thu, May 23, 2013 at 2:59 PM, Monte Goulding mo...@sweattechnologies.com
 wrote:

 Take a look at JSON.org for the file format. I have a desktop/server
 external that does ArrayToJSON and visa versa if that helps. It's utf8
 only. It's currently GPL licensed and I intend to do a commercial license
 when someone wants one ;-)

 --
 M E R Goulding
 Software development services

 mergExt - There's an external for that!

 On 24/05/2013, at 5:45 AM, Thomas McGrath III mcgra...@mac.com wrote:

  I have a server project where I need to send some JSON to a URL. I've
 never done this before. Has anyone got a simple example/explanation of how
 this is achieved?
 
  Thanks in advance.
 
  Tom
 
  -- Tom McGrath III
  http://lazyriver.on-rev.com
  mcgra...@mac.com
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode

 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2013-05-23 Thread J. Landman Gay
I'm working with a web person who wanted me to communicate recently 
using JSON (and I asked on the list about it like you did.) After 
looking at a couple of available libraries I thought the format was 
awkward and unnecessary for what we needed to do. I asked if they could 
just send and receive a simple tab-delimited string for the short amount 
of data we needed to exchange and they said sure. I was happy, and they 
were surprised that LiveCode could work so easily with that.


I like simple solutions, but I know not everyone is as accomodating as 
this customer. It might be worth asking though.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: JSON

2012-08-29 Thread Andrew Henshaw
There is a stack on RevOnline that might help,  I use it in an app and it works 
fine for my needs.

http://revonline2.runrev.com/stack/82/LibJson-1-0b

Andy

On 29 Aug 2012, at 13:16, Rod McCall rodmccall...@googlemail.com wrote:

 Dear All,
 
 I am currently developing a server application for a car simulator and
 part of it may use JSON. I'd appreciate any pointers to tutorials or
 even links to libraries on how to use JSON in LiveCode, therefore if
 you have any tips in this direction please let me know. . Otherwise I
 may have to revert to CSV or XML. From memory LiveCode did have some
 nice XML features but it's a while since I tried them out.
 
 Cheers,
 
 rod
 
 -- 
 Dr Rod McCall
 Researcher in in-car, mixed reality technology and gaming
 Interdisciplinary Centre for Security, Reliability and Trust
 University of Luxembourg
 Blog: www.rodmc.com twitter:rodlux
 Publications and Information available on my blog
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


  1   2   >