I am having trouble with json formation for an api call. I need something like this
{
"token": "87dd8f93-27ad-493c-8ab1-e75c50b8fb71",
"answers": [
{
"question": "Where are you from",
"ans": "t"
},
{
"question": "I am from tts",
"ans": "f"
}
]
}
i have array of hashes named answers which i made separately with something like
string json = JsonConvert.SerializeObject(account, Formatting.Indented);
after that i have to make with the token but then using the same process i got
{
"token": "87dd8f93-27ad-493c-8ab1-e75c50b8fb71",
"answers": [
"{\r\n
\"question\": \"Where are you from\",
\"ans\": \"t\"
}",
"{\r\n
\"question\": \"I am from tts\",
\"ans\": \"f\"
}"
]
}
public class Account
{
public string question { get; set; }
public string ans { get; set; }
}
and after that
if (ansNo.IsChecked == true)
{
Account account = new Account
{
question = quizText.Text,
ans = "f"
};
string json = JsonConvert.SerializeObject(account, Formatting.Indented);
Globals.answers[counter] = json;
}
else
{
Account account = new Account
{
question = quizText.Text,
ans = "t"
};
string json = JsonConvert.SerializeObject(account, Formatting.Indented);
Globals.answers[counter] = json;
}
need help please Thanks
account?