Below is a JSON output I have received :
[
{
positionCode: "POS1",
positionName: "POSITION 1",
positionDescription: "",
parentPosition: "POS2",
},
{
positionCode: "POS2",
positionName: "POSITION 2",
positionDescription: "",
parentPosition: "POS3",
}
]
This JSON data is the result of calling my Web API, which has the following structure :
return new JsonResult(query.Select(x =>
new { x.PositionCode, x.PositionName , x.PositionDescription , x.ParentPosition }).ToList());
However, I would like the output to look similar to this image : https://i.stack.imgur.com/9OUuX.png
What changes should I make in either my JavaScript code or C# Web API to achieve the desired outcome? Thank you!