[cl-json-devel] Achieving round-tripping for symbols with cl-json

Robert Goldman rpgoldman at sift.info
Sun Jan 13 21:56:56 UTC 2013


As far as I can tell, there's no way for CL-JSON to know whether
something was intended to be a string or a symbol (and, if a symbol,
what package).  I can think of two possible solutions:

1.  if it's specifically plist keys you are interested in, somehow mark
or know when an array is a plist.  Then simply decode all the keys as
symbols (in the keyword package?) and all the values as normal.

2.  More elaborate: set up a special kind of JSON object that will
capture the information about symbols, as appropriate.  E.g.,:

{ type: "lispSymbol", package: "pkg-name", name: "symbolName" }

and decode that as

'pkg-name:|symbolName|

That's probably the most robust way to do this.

cheers,
r




More information about the cl-json-devel mailing list