A jsexpr is one of: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.
- 'null
- boolean
- string
- integer
- inexact-real
- (vectorof jsexpr)
- (listof (cons symbol jsexpr))
Another alternative is:
A jsexpr is one of: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.
- #:null
- boolean
- string
- integer
- inexact-real
- (listof jsexpr)
- (listof (cons symbol jsexpr))
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.