[Python Edinburgh] JSON mapping library - recommendations?

Mark Smith judy at judy.co.uk
Mon Jan 10 16:59:47 CET 2011


Hi All,

Can anyone recommend a library for parsing/validating/serialising objects to
and from JSON data structures? I'm envisioning something a bit like an ORM,
although obviously without the 'R'...

The following is a bit inconsistent, but should illustrate the idea:

python:
class MyObject(JSONObject):
    name = StringField()
    roles = ListField(StringField(), min=0, max=10)
    pet = ObjectField({'name': StringField(),
            'type': PetTypeField()})

json:
{
    'name': 'Mark Smith',
    'roles': ['user', 'developer'],
    pet = {'name': 'Fido', 'type': 'dog'}
}

To be honest, the validation is more important than the mapping at this
stage.

--Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edinburgh/attachments/20110110/be505894/attachment.html>


More information about the Edinburgh mailing list