views:

544

answers:

2

I am using json in some AJAX request and am currently manually validating each entry using (if "key" in json.some_location.keys()) over and over again.

Is there a simpler way to do this (like XML validation)?

Note: I am open to validation libraries, but would like something I can drop into django itself (not python eggs).

+1  A: 

Take a look at JSON schema validators: http://barelyenough.org/blog/2007/07/json-schema-definition-languages/

Alex
A: 

itemscript.org has a json schema and validator.