此字串化 JSON 陣列無效,因為映射鍵和值不在引號中,但我想對其進行解碼:
"[{division: bacteriology, speciality: microbiology, tests: [appearence of urine], category: urine}]"
uj5u.com熱心網友回復:
由于您的字串不是正確的 json 格式,所以我嘗試通過將其轉換為正確的 json 來解碼這個特定的字串-
String data = "[{division: bacteriology, speciality: microbiology, tests: [appearence of urine], category: urine}]";
String formattedDataInJson = data.replaceAll("{", "{\"").replaceAll("}", "\"}").replaceAll(":", "\":\"").replaceAll(",", "\",\"").replaceAll("\"\"", "\"");
String division = jsonDecode(formattedDataInJson)[0]["division"];
uj5u.com熱心網友回復:
如果您正在尋找在線工具,您可以使用這個
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/491917.html
