lua-users home
lua-l archive

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


On Wed, Jan 26, 2011 at 08:12, Thomas Harning Jr. <harningt@gmail.com> wrote:
> If you want "pretty" JSON output that can still be parsed by a std
> json parser, I may be able to add this as an encoding option for
> luajson.

Would be great!

> I'll have to see if your example has a good set of rules to
> work off of.  Pretty-printing table-structure data can be
> straightforward, but typically has one-off cases to handle certain
> data scenarios:
>  * 1 primitive-element array
>  * very short object when nested deep
> ... etc

Well, in this particular case, I do care much for any specific rules,
as long as output is consistent and is readable on large data.

You may take python -mjson.tool as an example, or www.jsonlint.com, or
whatever pretty-printer you like.

Ah, there is one limitation: I need to be able to make output stable
(that is, table keys must be sorted). This is not a good idea to do by
default (too slow), but if you give me a hook to supply my own pairs()
to the pretty-printing algorithm, I'll be fine.

Thank you,
Alexander.