JsonObj.getString(key) 返回 0 而不是 0000
JsonObj.getString(key) returning 0 instead of 0000
我有一个简单的 json 字符串
{"username":"myemail@play.co.in","password":"0000"}
当我尝试使用以下代码读取 json 字符串时
JSONObject json = new JSONObject(jsonString);
Log.i(TAG,"uname "+json.getString("username"));
Log.i(TAG,"password "+json.getString("password"));
Password printing as "password 0" instead of "password 0000".
请帮我解决这个问题,我怎样才能读取字符串而不是值。
该值作为 int 返回。因此,前导 000 被删除,如果您在 json 中返回一个 int 000009,则本质上是相同的,它将被转换为 9!如果你想让所有字符都用像这样的“0000”这样的引号包围值元素。这样你将返回所有字符。
我有一个简单的 json 字符串
{"username":"myemail@play.co.in","password":"0000"}
当我尝试使用以下代码读取 json 字符串时
JSONObject json = new JSONObject(jsonString);
Log.i(TAG,"uname "+json.getString("username"));
Log.i(TAG,"password "+json.getString("password"));
Password printing as "password 0" instead of "password 0000".
请帮我解决这个问题,我怎样才能读取字符串而不是值。
该值作为 int 返回。因此,前导 000 被删除,如果您在 json 中返回一个 int 000009,则本质上是相同的,它将被转换为 9!如果你想让所有字符都用像这样的“0000”这样的引号包围值元素。这样你将返回所有字符。