I'm not sure how many users I have of my
json.plt PLaneT package, nor how many of them read my blog. But I thought I'd see if I could take a straw poll here. I'm thinking about changing the data definition in a backwards-incompatible way. What if I said:
A jsexpr is one of:
- 'null
- boolean
- string
- integer
- inexact-real
- (vectorof jsexpr)
- (listof (cons symbol jsexpr))
The nice thing about this representation is that it's easier to quote and quasiquote. The down-sides are that array manipulation is a little less convenient, and table lookup is slower.
Another alternative is:
A jsexpr is one of:
- #:null
- boolean
- string
- integer
- inexact-real
- (listof jsexpr)
- (listof (cons symbol jsexpr))
The nice thing about this is that both arrays and tables are conveniently represented as lists. But it's a little uglier for representing
null, which is necessary to avoid ambiguity between the JSON strings
{ "null" : [] } and
[[null]]. Note that it's also a little more subtle to distinguish between arrays and tables.
Other possible unambiguous representations of
null include
#\null,
#"null", or
#&0. Yech.
If you have any opinions, feel free to comment here or email me privately.
Update: Whoops, can't have them both be lists, because of the ambiguity between the empty object and empty array.