SLGOGP Draft 1/Discuss 2-2 LLSD

From Second Life Wiki
< SLGOGP Draft 1
Revision as of 06:49, 7 May 2008 by Cenji Neutra (talk | contribs) (New page: Have anyone thought about or implemented a JSON serialization (as mentioned)? As per the comment: it would be nice to impose on LLSD that the root element be an array or map, but not a sca...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Have anyone thought about or implemented a JSON serialization (as mentioned)? As per the comment: it would be nice to impose on LLSD that the root element be an array or map, but not a scalar, but since LLSD is already established and in-use, that could create the situation were we still have LLSD floating around that doesn't conform to that and hence can't be serialized into JSON.

Perhaps a better approach would be to just define the JSON serialization to always be a 1-element array containing the rest of the serialized structure. That only adds 2-bytes of overhead (for the "[" and "]"). It does create the situation where using the JSON data natively is slightly less 'natural' in that you always have to pull out the first array element of the data first. However, the JSON serialization is going to need some other 'unnatural' features anyway, for specifying the LLSD scalar types that don't directly map to JSON types, such as Binary, URI, etc.

(reason for the interest is because I have a system that uses JSON-RPC between components and in-world devices already. We also use XML-RPC, but XML isn't as compact as JSON - which is important when dealing with it in LSL)