How do Lisp developers deal with XML and JSON? Convert it to s-expressions.
As a common lisp developer, that is only very vaguely true for me.
The mapping I prefer for json<->Lisp is:
true: t
false: nil
null: :null
[] #()
{} (make-hash-table :test #'equal)
This falls out of my desire for the mapping to be bijective:- The only built-in type that is unambiguously a mapping type is hash-tabe.
- nil is the only value that is falsy in CL
- () is the same as nil, so we can't use it as an empty list; vectors are the obvious alternative
- Not really any obvious values left to use for "null" so punt to a keyword.
In Kernel I would use something like this:
Where &, :, @ are defined as: Using the "person" example from the JSON/syntax section on Wikipedia: I would then define `?` Now we can query the object.[0] https://web.cs.wpi.edu/~jshutt/kernel.html
In Clojure