POST を実行してから、JSON 応答を文字列に読み取ろうとしています。
私の問題は、自分のオブジェクトを DataContractJsonSerializer に渡す必要があることだと思いますが、応答を連想配列または何らかのキー/値形式にする方法があるかどうか疑問に思っています。
私のJSONは次のようにフォーマットされています: {"license":"AAAA-AAAA-AAAA-AAAA"} 私のコードは次のとおりです:
using (Stream response = HttpCommands.GetResponseStream(URL, FormatRegistrationPost(name, email)))
{
string output = new StreamReader(response).ReadToEnd();
response.Close();
DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(string));
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(output));
string results = json.ReadObject(ms) as string;
licenseKey = (string) results.GetType().GetProperty("license").GetValue(results, null);
}