[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luajson vs. null
- From: "Thomas Harning Jr." <harningt@...>
- Date: Sat, 11 Sep 2010 17:23:12 -0400
It is possible, it may take a tweak in the handling code to add the capability
On 9/11/10, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Sat, Sep 11, 2010 at 21:41, Thomas Harning Jr. <harningt@gmail.com>
> wrote:>
>> On 9/11/10, Alexander Gladysh <agladysh@gmail.com> wrote:
>>> On Sat, Sep 11, 2010 at 18:19, Thomas Harning Jr. <harningt@gmail.com>
>>> wrote:
>>>> On 9/11/10, Alexander Gladysh <agladysh@gmail.com> wrote:
>
>>>> If you pass in the json.decode.simple config table to decode, you will
>>>> get actual nils for null and undefined.
>
>>>> json.decode("null", json.decode.simple)
>>>> json.decode.getDecoder(json.decode.simple)("null")
>
>>> Any reason why it is not documented?
>
>> Will put it on my ToDo list for the project to enhance documentation
>> to include such basics.
>
> Cool, thanks!
>
> While we're on it: I have a special case (not for default json2lua
> mode) where I need luajson to convert JSON string keys that are
> numbers (like "1" or "123.456", but not "123a") to numbers in Lua.
>
> Example:
>
> { "key": "value", "1": "one", "20": "twenty" }
>
> Becomes:
>
> { ["key"] = "value", [1] = "one", [20] = "twenty" }
>
> Is this possible?
>
> Alexander.
>
>
--
Thomas Harning Jr.