JSON decoding

Douglas Crockford crock at yahoo-inc.com
Thu Oct 26 08:22:00 PDT 2006


Brendan Eich wrote:
> On Oct 25, 2006, at 7:24 AM, Dave Herman wrote:
> 
>>> I thought you might mean that, but I don't see how to do it.  We 
>>> can't declare a type for "the set of all valid JSON values".  If we 
>>> take an
>>
>> Do we need to? If you can't detect it statically or express it as a 
>> type, you can still detect it dynamically.
> 
> Sure, and that's what Bob is proposing. We just didn't see it last week 
> at the face to face. The built-in encoder must produce a string, but the 
> customizable method can produce only a JSON value, instead of producing 
> an encoded substring that would then have to be validated by parsing.  
> Then the encoder can check the value for cycles, do standard stuff like 
> pretty encoding, etc.
> 
> Doug, what do you think?

I think this is getting out of hand. What was originally intended was a 
convenient little serializer that would be a little faster and more 
convenient than the current json.js. Bob wants to turn it into a 
transformation engine. I think he should do all of his transformations 
in JavaScript, and then hand the structures to a minimal toJSONString 
method as the final step. I prefer to keep the standard simple, and let 
Bob do complicated on his side.



More information about the Es4-discuss mailing list