Code example for JSONArray

Methods: getString, length

0
   * @return 
   * @throws Exception 
   */ 
  private static byte[] convertJSONToByteArray(JSONArray jsonArray) throws Exception
  { 
    if(jsonArray != null && jsonArray.length() == 1)
    { 
      String base64 = jsonArray.getString(0);
      byte[] bytes = Base64.decodeBase64(base64);
      return bytes;
    } 
    else 
      throw new Exception("too many base64 encoded data in one parameter");
  } 
 
  /** 
   * @param jsonValues 
   * @return 
   * @throws JSONException 
   */ 
  private static long[] convertJSONToLongArray(JSONArray jsonArray) throws JSONException