I have two JSON files. How can I relate the two JSONs files.
{
"data": {
"id": "in",
"type": "product-catalogue",
"relationships": {
"products": {
"data": [
{
"type":"group1",
"id": "in-group-1"
},
{
"type":"group2",
"id": "in-group-2"
}
]
}
}
},
and few details of group1 and group2 model is attached in included part (ID remains the same).
I have the another JSON's for group1 and group2 describing the complete details with same ID.
"data": {
"id": "in-group-1",
"type": "group1",
"relationships": {
"sections": {
"data": [
{
"id": "in-header",
"type": "header"
},
{
"id": "in-features",
"type": "feature"
},
{
"id": "in-pricing",
"type": "pricing"
},
{
"id": "in-toc",
"type": "toc"
}
]
},
How can I relate the two jsons.
I am using the polymorphic relation for different type in data.
Eg - products is my base class and it will extend for group1 & group2.
product-catalogue: hasMany(''products)
now I have the group1 and group 2 data loaded. How I can load the details JSON now.
Aucun commentaire:
Enregistrer un commentaire