This is my json:
[
{
"ChangeFlowsFromParent":"false",
"ChangeFlowsToParent":"true",
"StreamType":"mainine",
"streamName":"ArgOS_2_0",
"Parent":"none",
"Compliance":"Released",
"children":[
{
"ChangeFlowsFromParent":"true",
"ChangeFlowsToParent":"true",
"StreamType":"Release",
"streamName":"ArgOS_2_0_DHAL1",
"Parent":"ArgOS_2_0",
"Compliance":"Released",
"children":[
{
"ChangeFlowsFromParent":"false",
"ChangeFlowsToParent":"true",
"StreamType":"Release",
"streamName":"ArgOS_child_DHAL2",
"Parent":"ArgOS_2_0_DHAL1",
"Compliance":"Released",
"children":[
{
"ChangeFlowsFromParent":"false",
"ChangeFlowsToParent":"true",
"StreamType":"Release",
"streamName":"ArgOS_child_Gen2",
"Parent":"ArgOS_child_DHAL2",
"Compliance":"Released"
}
]
}
]
},
{
"ChangeFlowsFromParent":"true",
"ChangeFlowsToParent":"true",
"StreamType":"Release",
"streamName":"ArgOS_2_0_DHAL2",
"Parent":"ArgOS_2_0",
"Compliance":"NA"
},
{
"ChangeFlowsFromParent":"false",
"ChangeFlowsToParent":"false",
"StreamType":"Release",
"streamName":"ArgOS_2_0_DHAL3",
"Parent":"ArgOS_2_0",
"Compliance":"NA"
}
]
}
]
and this is my Model
public class TreeModel
{
public string StreamName { get; set; }
public string ParentName { get; set; }
public string StreamType { get; set; }
public bool ChangeFlowsFromParent { get; set; }
public bool ChangeFlowsToParent { get; set; }
public string Compliance { get; set; }
public string Parent { get; set; }
}
So I have a data in the form of my model and I need to create a nested Json structure like the one mentioned above. Based on the parent = streamname, a children tag will have to be created and that model item would be added as a json array.
This JSON is for my tree graph. How is this achievable?