[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: JSON to Lua syntax converter?
- From: "Eric Tetz" <erictetz@...>
- Date: Fri, 1 Feb 2008 12:44:55 -0800
On Feb 1, 2008 12:03 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
> Perhaps one could simply ignore the null altogether... as unquoted
> null will resolve to nil in loadstring...
Good point. But I take back what I said about the first three being
'easy enough'. :)
You need to tokenize the input so you can determine what's in a string
and what's not. For instance, there's nothing that says a key or value
couldn't be the string "{\"items": [ {\"[{,null\": \"null},\\,\"},
null, {\",null\": \",{ = null,\"}]".
Lexing that would be simple. Parsing it with a regular expression...
not so much.