I defined a class
class Person(colander.MappingSchema):
name = colander.SchemaNode(colander.String())
age = colander.SchemaNode(colander.Int()
and I have a coming json string that may be like:
{
'name': 'keith',
'age': '20',
'friends': [('1', 'jim'), ('2', 'bob'), ('3', 'joe'), ('4', 'fred')],
'phones': [{'location': 'home', 'number': '555-1212'},
{'location': 'work', 'number': '555-8989'}],
...
}
I only want to validate name
and age
, and I do not care about other fields (and I don't know all the other possible fields). Is there any way to only validate the two fields while ignoring others?