[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple Lua-only JSON decoder
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 18 Apr 2017 07:25:20 +0200
2017-04-18 16:03 GMT+02:00 Martin <eden_martin_fuhrspam@gmx.de>:
> On 04/16/2017 11:47 PM, Dirk Laurie wrote:
>> My primitive JSON decoder, which operates by lexically translating
>> a JSON code to a Lua table literal, now does three things:
>>
>> 1. Unicode codepoints translated, e.g. from \u00e9 to \u{00e9}.
>> 2. List delimiters translated from […] to {…}.
>> 3. Keys translated e.g. from "item": to ["item"]=.
> I've done some years ago similar thing (>1). Problems with such
> implementation are probably same: security and format incompatibilities.
> (But this is a nice hack, usually it is faster than all other
> JSON-loading tools except lua-cjson. And yes, practically it works
> in most cases. So using it is potentially risky but easy.)
Well, after all the very useful comments — thanks a lot — and this
bit of moral support — much appreciated — I'll reveal the identity
of the website. The typical URL with which to extract data is for example
https://apps.wikitree.com/api.php?action=getProfile&key=Turing-3
and the API home page is at
https://apps.wikitree.com/apps/
For getBio, which consists mainly of one long character string in WikiMedia
markup, I do not use this decoder.