I have a class BasketItem:
public class BasketItem
{
public long FoodId;
public int Count;
}
I have a AddToBasket controller which adds items to basket and then returns the json value of BasketItem[]:
I'm using return Json(items); which items is of type BasketItem[].
The returned json is like:
[{"foodId":6,"count":1},{"foodId":5,"count":1},{"foodId":4,"count":1}]
while it Should be like:
[{"FoodId":6,"Count":1},{"FoodId":5,"Count":1},{"FoodId":4,"Count":1}]
How to prevent return Json from renaming the key names?