'I need to serialize & deserialize model class defination in django

I am quite new to django, I have class.

from django.db import models

class Person(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)

Now user is going to give me a JSON/XML file

<item>
<name>first_name</item_name>
<type>char</type>
</item>
<item>
<name>age</item_name>
<type>char</type>
</item> 

Based on the file, model class should change. How can I load model class from JSON/XML file?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source