JSON decoding

Bob Ippolito bob at redivi.com
Fri Oct 20 13:35:00 PDT 2006


On 10/20/06, Brendan Eich <brendan at mozilla.org> wrote:
> On Oct 20, 2006, at 4:11 PM, Bob Ippolito wrote:
>
> > The encoder should have an object hook the same way the decoder does.
>
> Symmetry, what a good idea.  TG1 members should consider this seriously.
>
> > Throw away the filter.
>
> There was some desire to filter without copying.

What was the use case for filtering? I've never seen anyone do that.

> > Filtering functionality can be implemented if necessary by writing an
> > encoder hook that inspects the object. If it needs to remove some
> > key:value pairs, then it would create a new object that is missing the
> > keys that should be filtered.
>
> That's the copy we hoped to avoid.  Not a problem in your simplejson
> experience?

Not a problem because I've never seen anyone perform such a filter. If
the output needs to differ from the input it's usually based on the
*value* not the key:value pair. When the encoding needs to differ it's
usually not strict subset of the input, but a different object
altogether.

-bob



More information about the Es4-discuss mailing list