I have a JObject like this:
JObject grid =
new JObject(
new JProperty("myprop", "value 1"),
new JProperty("name",
new JArray(
new JObject(
new JProperty("myprop2", "value 2")
)
)
)
)
Nothing wrong with that.
But, I have an object that I want to iterate over, and add them to my JObject, but how to do that?
Like this? (which is not valid, I know)
JObject grid =
new JObject(
new JProperty("myprop", "value 1"),
new JProperty("name",
new JArray(
new JObject(
new JProperty("myprop2", "value 2"),
foreach(var value in myObject) {
new JObject(
new JProperty(value.Name, value.Value)
)
}
)
)
)
)
How can I do this?