I have a mysql table that I am tracking relating items. (this table belong to Artilce table) [this is the datastructer from mysql][1] [1]: https://ift.tt/YDls7aO
how can I generate a json from Ruby that looks like this. (I need that for D3JS visualisation tree)
{
"id":1,
"art_type":"V",
"children":[
{
"id":7,
"art_type":"V",
"children":[
{
"id":9,
"art_type":"V",
},
{
"id":10,
"art_type":"V",
}
]
},
{
"id":8,
"art_type":"V",
"children":[
{
"id":11,
"art_type":"R"
},
{
"id":12,
"art_type":"V"
},
{
"id":13,
"art_type":"V"
}
]
}
]
}
Aucun commentaire:
Enregistrer un commentaire