[Baypiggies] newbie question - json as pickler

ben lipkowitz fenn at SDF.LONESTAR.ORG
Mon Feb 22 10:00:28 CET 2010


On Mon, 22 Feb 2010, K. Richard Pixley wrote:
> I was hoping to use json as a direct pickle replacement for some log files, 
> wire transfers, and state dump/restores, at least for debugging, because it's 
> essentially human readable.  But I've run into two problems.
>
> Problem #1: most json encoders, (including the standard library json module), 
> don't encode/decode arbitrary objects.  They seem to be aiming for cross 
> language exchange rather than persistence or serialization of 
> python-to-python transfers.  I have found a couple on the cheese shop that do 
> use a standard encoding, so this isn't necessarily a blocker.

you might want to look into YAML:
http://pyyaml.org/wiki/PyYAMLDocumentation

it automatically serializes any pure python objects (no SWIG wrappers etc)

also, JSON is valid YAML

   -fenn


More information about the Baypiggies mailing list