LC8 - Stumbling into JSON

Devin Asay devin_asay at byu.edu
Tue Jun 14 15:09:26 EDT 2016


> On Jun 14, 2016, at 9:52 AM, Richard Gaskin <ambassador at FourthWorld.com> wrote:

> > As you’ll see it’s a whole new world of functionality, and so simple
> > to access through LiveCode, using GET and POST requests.
> 
> ...and with LC Server also easy to provide.

That’s the rest of the story. In most of my projects I am both the creator and consumer of the API. All in LiveCode.
> 
> When designing a REST API I've found Vinay Sahni's "Best Practices for Designing a Pragmatic RESTful API" the best one-stop-shopping for good, clear ideas:
> http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api
> 
> Andre Garzia's revSpark library helps with implementing good REST APIs:
> http://andregarzia.com/pages/en/revspark/
> 
> Extra bonus points:  if both your client and server are written in LiveCode, you can bypass JSON and use LSON instead, LiveCode's own native array serialization provided by arrayEncode and arrayDecode. These binary data streams can even be compressed with LC's built-in compress function for faster transport.
> 
> Super-easy to work with in LC, and being as native to LC as JSON is to JavaScript you'll be hard-pressed to find a data format more efficient when sharing array data between LC clients and LC servers.
> 
> In fact, if you have an API that may sometimes deliver to LC-based clients and sometimes to Web clients, you can take a tip from Vinay's article and have JSON as the default but allow the requesting URL to end with ".json" to specify JSON as the delivery format.

Thanks for the great links, Richard! Bookmarked.

Devin

Devin Asay
Office of Digital Humanities
Brigham Young University



More information about the use-livecode mailing list