[Python Edinburgh] JSON mapping library - recommendations?
dougal85 at gmail.com
Tue Jan 11 15:03:07 CET 2011
On Tuesday, 11 January 2011 at 09:20, Mark Smith wrote:
> I was thinking a better approach would be a declarative approach, such as that used by various ORM frameworks, with optional validation points - so you'd get some validation for free (it's a string and it's not empty and not null), but you could implement extra validation functions if you needed them (it's a string that looks like a phone number). Maybe I put too much emphasis on validation in my original email.
I imagine you could probably use Django's ORM for this. As long as you are able to describe the structure well enough. Just create model instances and use Model validation to check they are valid but never actually save etc.
Or you could pass each JSON object through a Django form and use the validation to end up with cleaned_data - I used this fairly recently to validate a CSV file. It worked pretty well but I never actually got around to checking the overhead of creating up to 10,000 temporary form instances... Hmm.
Both feel a bit over the top though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Edinburgh