I'm trying to create named JArrays using JSON.net. I have a list of food, like Milk in the example below.
On initial writing of this data, all food items in the List (say List()) have an array created for each food item, as child arrays in the Items array.
Then later on, when adding a food JObject, I add it to the appropriate sub-array.
The problem is creating the sub-arrays for each item in my list. Maybe it's due to it being 5am, but I just can't seem to figure it out.
PS: I know I could create an example class like the Items class below, however.. I'm trying to do this dynamically. I have a list of data that I can pull the entire food list from (in string format), so it would save hours of tedium if I could do this via the List I have for the food items.
Any help is appreciated. Thank you
class Items{
public List<string> Milk {get; set;}
public List<string> Bread {get; set;}
}
// Example Json
{
"Items":[
"Milk":
[
{
"name": "old milk",
}
]
]
}