I have an ASP.NET MVC 4 Web API app using EntityFramework for ORM.
In the JSON I return, there are some cases where the same child node is present for multiple parent nodes. In these cases, the first occurrence of the child node is fully visible with all it's members. Any subsequent occurrence shows up as a $ref to the first occurrence. I'd like instead to see the full object everytime it shows up in the JSON returned.
For example, instead of seeing:
[{
"$id": "1",
"userId": 1,
"Badge": {
"$id": "2",
"badgeId": 1,
"badgeName": "Gold"
}
}, {
"$id": "3",
"userId": 2,
"Badge": {
"$ref": "2"
}
}]
i'd like to see:
[{
"$id": "1",
"userId": 1,
"Badge": {
"$id": "2",
"badgeId": 1,
"badgeName": "Gold"
}
}, {
"$id": "3",
"userId": 2,
"Badge": {
"$id": "4",
"badgeId": 1,
"badgeName": "Gold"
}
}]
Basically I want to get rid of any "$ref" in the JSON. Is there a way?
Thanks!