Base64 decoding of JSONObject in Android 2.1
I need to decode JSONObject in Android 2.1 with Base64.I know that Base64 class supports Android 2.2+,that's why I include the source code in my project.So I need 开发者_如何学Pythonto do something like that :
JSONObject clientHash = new JSONObject();
byte[] tmpSecData = Base64.decode(clientHash.getJSONObject("client_auth_hash"));
Any suggestions how to do that or is it possible?
Lets try it,
- Convert the clientHash.getJSONObject("client_auth_hash") in String then byteArray,
then use,
byte temp[]; Base64 b = new Base64(); String jsonString = clientHash.getJSONObject("client_auth_hash").toString(); temp = b.decode(jsonString.getBytes());
then use your temp byte[].
Hope this will help you. If its work then inform me. Thanx.
精彩评论