私のJSONString
(ruleFormJSONString)が次のような状況に陥っています:
{
"ruleDescription":"Test Rule2 Description",
"urlId":"1",
"listOfBusinessdays":["1","2","5","6","7"],
"status":"1",
"hierarchyId":"3",
"fromTime":"08:00",
"toTime":"18:00",
"dcnid":"1",
"eventId":"1",
"rowstate":"1",
"listOfLocations":["ASM","DEL"],
"ruleName":"Test Rule2",
"ruleId":"7","msgId":"1"
}
ご覧のとおりfromTime
、 とという名前の 2 つの属性がtoTime
あります。:
Javaでこれを解析している間、私は使用しました
JSONObject ruleFormJSON = JSONObject.fromString(ruleFormJSONString);
String fromTime = (String)ruleFormJSON.getString("fromTime");
String toTime = (String)ruleFormJSON.getString("toTime");
私は取得してNumberFormatException
います
java.lang.NumberFormatException: 入力文字列の場合: "18:00"
String
対応する変数の値を取得する方法を教えてください。
どんな助けでも大歓迎です。