Re: JSON-serializable object

> On Nov 16, 2016, at 2:22 PM, Shane McCarron <> wrote:
> Are there instances where it just makes sense to pass the whole thing as a DOMString?  Inside that is JSON, but who cares?  It is just being passed THROUGH the browser to somewhere else.  The Verifiable Claims Data Model work falls into the category, for example.  So does (potentially) the payment method specific data that is in channeled through the browser payments API.  It should NEVER be inspected by the browser payments API implementation.  The contents are opaque.  Might as well just be a string.

That’s a real interesting approach to consider as it eliminates most of the serialization concerns from the API by making it the responsibility of the caller to do the serialization. It should be easy enough for a caller to wrap a JSON.stringify() around the object it would otherwise pass.  It actually make the API more flexible because it allow other approaches other than  using JSON.stringify to create the string.  For example, there may well be cases where it is easier to use a template string to construct a string containing a specific JSON text then it is to construct an object graph that will serialize  to that same JSON text.  Also, it would permit a client to store or cache pre-serialized JSON texts without having to deserialize on each use. 


Received on Wednesday, 16 November 2016 23:23:06 UTC