[Python Edinburgh] JSON mapping library - recommendations?

Dougal Matthews dougal85 at gmail.com
Mon Jan 10 20:13:38 CET 2011


I can't say that I know of any. 


However, I can't help but think, what the hell are you doing? :) You want JSON to have a schema. Isn't this exactly what XML was intended for any why many people hate it?


I'd be interested to hear the use case for this. I can only imagine its because JSON is coming from somewhere externally? Is this for an API? 


Dougal


-- 
Dougal Matthews
www.dougalmatthews.com
www.twitter.com/d0ugal

On Monday, 10 January 2011 at 15:59, Mark Smith wrote:

> 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
> 
> _______________________________________________
> Edinburgh mailing list
> Edinburgh at python.org
> http://mail.python.org/mailman/listinfo/edinburgh
> 
> 
> 




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


More information about the Edinburgh mailing list