I´m trying to recreate this json:
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"id": "90551bd1bcf6474dba09c96617a33638",
"password": "hoeIX1.i-.M]wiu9"
}
}
},
"scope": {
"project": {
"id": "2440e4fa1725452cb2e14506cb5d63ec"
}
}
}
}
Right now I´m doing this:
JObject auth = new JObject(
new JProperty("auth", new JObject(
new JProperty("identity", new JObject(
new JProperty("method",JArray.Parse("[\"password\"]")),
new JProperty("password", new JObject(
new JProperty("user", new JObject(
new JProperty("id", JValue.CreateString(identityWithProject.Username)),
new JProperty("password", JValue.CreateString(identityWithProject.ProjectName))))))),
new JProperty("scope", new JObject(
new JProperty("project", new JObject(
new JProperty("id", JValue.CreateString(identityWithProject.ProjectName))))))))));
I get this error:
"Can not add Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JArray."
The line that is not working is:
new JProperty("method",JArray.Parse("[\"password\"]"))
If I remove the JArray part it works fine, how could I fix it so that it works with the array part? Most examples I have found are an array of JObjects which is not the case. Thanks!