問題:
I would like to parse data from JSON which is of type String
.我想解析來自 JSON 類型的數據String
。 I am using Google Gson .我正在使用Google Gson 。
I have:我有:
jsonLine = "
{
"data": {
"translations": [
{
"translatedText": "Hello world"
}
]
}
}
";
and my class is:我的班級是:
public class JsonParsing{
public void parse(String jsonLine) {
// there I would like to get String "Hello world"
}
}
解決方案:
參考一: https://en.stackoom.com/question/N2P7參考二: https://stackoom.com/question/N2P7