开发者

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,

  1. Convert the clientHash.getJSONObject("client_auth_hash") in String then byteArray,
  2. then use,

    byte temp[];
    Base64 b = new Base64();
    String jsonString = clientHash.getJSONObject("client_auth_hash").toString();
    temp = b.decode(jsonString.getBytes());
    
  3. then use your temp byte[].

Hope this will help you. If its work then inform me. Thanx.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜