which is the best way to save and display parent nodes with different child nodes(json)

时间:2016-04-15 15:16:04

标签: mysql sql json

My script makes an ajax request to a json as you can se below:

{"boxes": [{
    "type": "cover",
    "name": "Name",
    "manu":"Manu",
    "img": "img.jpg",
},{
    "type": "type1",
    "store":"Store",
    "src": "Src",
    "link":"link",
    "de":"de",
    "por": "por"
},{
    "type": "article",
    "site":"site",
    "src": "src",
    "link":"link",
    "title": "title",
    "txt": "txt"
},{
    "type": "image",
    "src": "src",
    "link":"link"
},{
    "type": "video",
    "channel":"channel",
    "name": "name",
    "video":"video"
}]}

I would like to know which is the best way to save and display this data because if I save all content in a json file as it is now, the file gets huge and it is not good for performance.

I tried to save it in a BD (MySql) but as each parent node has diferent child nodes, I couldn't save it in the same table.

Someone has ideas to solve it?

Thank you!

0 个答案:

没有答案