Removing py/object key/value pairs from JSON output

3,212 views
Skip to first unread message

Jamie Bullock

unread,
May 25, 2011, 4:13:20 AM5/25/11
to jsonpickle

Hi,

Thanks for making jsonpickle, it's a great module.

Is there a way to configure jsonpickle so that it omits the 'py/
object': '__main__.Foo' pairs from its output? Of course I can parse
them out myself, but that seems kind of ugly. I just want to use the
module to *generate* json, I don't need to de-serialize, so the 'py/
object' suff is kind of redundant.

Thanks,

Jamie

John Paulett

unread,
May 25, 2011, 6:04:07 AM5/25/11
to jsonp...@googlegroups.com

Jamie,
You should be able to remove the jsonpickle-added attributes with the unpickable flag:

    jsonpickle.encode(value, unpicklable=False)

John

> --
> You received this message because you are subscribed to the Google Groups "jsonpickle" group.
> To post to this group, send email to jsonp...@googlegroups.com.
> To unsubscribe from this group, send email to jsonpickle+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jsonpickle?hl=en.
>
Reply all
Reply to author
Forward
0 new messages