simplejson/simplejson — Issue #20: Make encoding behavior of simplejson possible to override
Author: nathan-rice
Created: 2011-10-26 21:33:38+00:00
State: open

I would really like to be able to control how a variable is encoded directly. Currently, if a variable is of a type recognized by simplejson it will be encoded automatically, with no imput on my part. I've bumped up against the inability to override atomic encode actions repeatedly, and it has made using this library terribly unpleasant.

Specifically...

I wanted to override encoding so that certain strings would be encoded without surrounding quotes, for code generation. The way the code there is no way to do this short of hacking the module, which is silly.

I want to serialize a graph with cycles. It is really easy to get rid of cycles by ignoring edges to already visited nodes in the graph when moving outward from a visited node. I would love to add this bit of logic, but I can't do that without totally rewriting your class (ironically you already do this with markers, but since I can't get into the code anywhere, that is pretty useless to me).

Ideally, an api for this would let you specify a "translator" function, as well as input/output filters.