我在Flutter中有一个Json解析项目,Json如下所示:
{
"Dependents":[
{
"Name": "Kim",
"Relationship": "Parent",
"Entitlements": [
{
"GP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"OPS": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"IP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Dental": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Optical": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Maternity": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
}
]
},
{
"Name": "Tim",
"Relationship": "Spouse",
"Entitlements": [
{
"GP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"OPS": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"IP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Maternity": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
}
]
},
{
"Name": "Lim",
"Relationship": "Child",
"Entitlements": [
{
"GP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"OPS": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Dental": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Optical": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"Maternity": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
}
]
},
{
"Name": "Xim",
"Relationship": "Child",
"Entitlements": [
{
"GP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"OPS": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
},
{
"IP": {
"Entitlement": "10000",
"Utilisation": "500",
"Balance": "9500"
}
}
]
}
]
}
如您所见,在Dependents下有多个用户,而在这些用户下,他们有自己的授权。
我目前遇到的问题是:
由于每个用户都有不同的授权与之关联,我该如何遍历授权以打印出其下的所有地图。
敬请协助。
https://stackoverflow.com/questions/52034895
复制相似问题