i'm trying to parse json array response from server. for example i can simply parse this response :
echo json_encode(['result' => 0,'h'=>1,'m'=>2]);
but for parse this json format:
echo json_encode(['result' => 0,'hour'=>1,'minute'=>2]);
i get this error:
E/Response:: {"result":0,"hour":"1","minute":"35"}
E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: Process: pishguy.ir.asrebidree, PID: 6322
E/AndroidRuntime: java.util.UnknownFormatConversionException: Conversion: س
E/AndroidRuntime: at java.util.Formatter$FormatToken.unknownFormatConversionException(Formatter.java:1399)
My code:
JSONObject jsonObject = new JSONObject(response);
String result = jsonObject.getString("result");
if (result.equals("0")) {
String hore = jsonObject.getString("hour");
String minute = jsonObject.getString("minute");
}
UPDATED
problem is hour and minute words, not result key in json array. after change hour and minute to h and m problem solved