nalysieren Sie die JSON-Antwort in C #
Ich erhalte eine JSON-Antwort, nachdem ich eine Anfrage an eine API gestellt habe.
The JSON ist wie:
{
"results": [
{
"alternatives": [
{
"confidence": 0.965,
"transcript": "how do I raise the self esteem of a child in his academic achievement at the same time "
}
],
"final": true
},
{
"alternatives": [
{
"confidence": 0.919,
"transcript": "it's not me out of ten years of pseudo teaching and helped me realize "
}
],
"final": true
},
{
"alternatives": [
{
"confidence": 0.687,
"transcript": "is so powerful that it can turn bad morals the good you can turn awful practice and the powerful once they can teams men and transform them into angel "
}
],
"final": true
},
{
"alternatives": [
{
"confidence": 0.278,
"transcript": "you know if not on purpose Arteaga Williams who got in my mother "
}
],
"final": true
},
{
"alternatives": [
{
"confidence": 0.621,
"transcript": "for what pink you very much "
}
],
"final": true
}
],
"result_index": 0
}
Ich muss zwei Dinge tun, um das json-Ergebnis zu erreichen (ich behalte es als String *):
Hol den / die Transkriptionsteil (e) der JSON-Antwort.Verarbeiten Sie diese Zeichenfolgen.
Ich bin neu in diesem. Das Konvertieren in einen String wird nur als Serialisierung bezeichnet. Warum hilft hier die Deserialisierung?Converting to string: Ich habe es gemacht mit:
var reader = new StreamReader(response.GetResponseStream());
responseFromServer = reader.ReadToEnd();
Wie kann man das erreichen?