title: How to validate a json object in django
body: <p>I'm submitting a JSON to a django view with AJAX. The JSON looks like the following:</p>
  
  <pre><code>{
     "code":"9910203040", // required
     "name":"Abc", // required
     "payments":[
        {
           "amount":300, // required
           "name":"efg", // required,
           "type": 2 // can be empty
        },
        {
           "amount":100,
           "name":"pqr",
           "type": 3
        }
     ]
  }
  </code></pre>
  
  <p>The payments list can be of any size. How can I validate this in Django? Is it possible to use Django Forms to validate this? If it was Spring, I would create Request classes and use annotations on fields but can't figure out how to do this in Django.</p>