lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, May 9, 2011 at 10:59 AM, Mark Pulford <mark@kyne.com.au> wrote:
> Hi,
>
> Lua CJSON provides fast JSON parsing and encoding support for Lua
> using the C API.
>
> You can find it here:
>    http://www.kyne.com.au/~mark/software/lua-cjson.php
>

Thank you for sharing this!

BTW, I've just noticed that it introduces extra spaces into the
resulting JSON when encoding stuffs, for example

    local cjson = require 'cjson'
    print(cjson.encode({dog=3}))

and the output is

    { "dog": 3 }

Please note the extra spaces among tokens. I don't find any option to
disable that and it seems to me that the extra spaces are hard-coded
by looking at the C source. It'll be a (small) waste of bandwidth for
web applications. Am I missing something here?

Your cjson library makes me less motivated to introduce a native JSON
encoder/decoder in our ngx_lua nginx module ;)

Thanks!
-agentzh