I have a dictionary like below
{
"a": 2,
"b": 1,
"dd": {
"xx": {
"name": "Xx XxRay",
"guid": "967436db-3f7b-40c3-94cb-45c7ac5a1787"
},
"yy": {
"name": "Yy YyZee",
"guid": "db12b2b3-554d-42a8-b34e-9995c9719999"
}
}
}
I am trying to use marhsall with in Restx , but fail to make it to work.
First, i defined the internal structure
details_model = api.model('Details', {
"name": fields.String(required=True,
description='Name'),
"guid": fields.String(required=False, description='GUID')
})
Secondly, I defined which i am not using currently.
dd_model = api.model('dd', {
'shortname': fields.Nested(details_model)
})
Finally,
response_model = api.model('Response', {
'a': fields.Integer(min=0, description='Total Number of Results'),
'b': fields.Integer(min=0, description='Total Number of X'),
'dd': fields.Nested(fields.String, details_model)
})
How can i construct this structure??