How to add jarray Object into JObject
Posted
by
user2882431
on Stack Overflow
See other posts from Stack Overflow
or by user2882431
Published on 2013-10-28T11:54:24Z
Indexed on
2013/10/28
15:54 UTC
Read the original article
Hit count: 196
How to add JArray
into JObject
? I am getting an exception when changing the jarrayObj
into JObject
.
parameterNames = "Test1,Test2,Test3";
JArray jarrayObj = new JArray();
foreach (string parameterName in parameterNames)
{
jarrayObj.Add(parameterName);
}
JObject ObjDelParams = new JObject();
ObjDelParams["_delete"] = jarrayObj;
JObject UpdateAccProfile = new JObject(
ObjDelParams,
new JProperty("birthday", txtBday),
new JProperty("email", txtemail))
I need output in this form:
{
"_delete": ["Test1","Test2","Test3"],
"birthday":"2011-05-06",
"email":"[email protected]"
}
© Stack Overflow or respective owner