Class JSONUtil

java.lang.Object
com.landawn.abacus.util.JSONUtil

public final class JSONUtil extends Object
Since:
0.8
Author:
Haiyang Li
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONArray jsonArray)
     
    static <T> T
    unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONObject jsonObject)
     
    static <T> T
    unwrap(Class<? extends T> cls, org.json.JSONArray jsonArray)
     
    static <T> T
    unwrap(Class<? extends T> cls, org.json.JSONObject jsonObject)
     
    static <T> List<T>
    unwrap(org.json.JSONArray jsonArray)
     
    static <T> List<T>
    unwrap(org.json.JSONArray jsonArray, com.landawn.abacus.type.Type<T> elementType)
     
    static <T> List<T>
    unwrap(org.json.JSONArray jsonArray, Class<T> elementClass)
     
    static Map<String,Object>
    unwrap(org.json.JSONObject jsonObject)
     
    static org.json.JSONArray
    wrap(boolean[] array)
     
    static org.json.JSONArray
    wrap(byte[] array)
     
    static org.json.JSONArray
    wrap(char[] array)
     
    static org.json.JSONArray
    wrap(double[] array)
     
    static org.json.JSONArray
    wrap(float[] array)
     
    static org.json.JSONArray
    wrap(int[] array)
     
    static org.json.JSONArray
    wrap(long[] array)
     
    static org.json.JSONArray
    wrap(short[] array)
     
    static org.json.JSONObject
    wrap(Object entity)
    wrap(entity) -> wrap(Maps.deepEntity2Map(entity, true))
    static org.json.JSONArray
    wrap(Object[] array)
     
    static org.json.JSONArray
    wrap(Collection<?> coll)
     
    static org.json.JSONObject
    wrap(Map<String,?> map)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • wrap

      public static org.json.JSONObject wrap(Map<String,?> map)
      Parameters:
      map -
      Returns:
    • wrap

      public static org.json.JSONObject wrap(Object entity)
      wrap(entity) -> wrap(Maps.deepEntity2Map(entity, true))
      Parameters:
      entity -
      Returns:
      See Also:
    • wrap

      public static org.json.JSONArray wrap(boolean[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(char[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(byte[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(short[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(int[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(long[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(float[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(double[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(Object[] array) throws org.json.JSONException
      Parameters:
      array -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • wrap

      public static org.json.JSONArray wrap(Collection<?> coll)
      Parameters:
      coll -
      Returns:
    • unwrap

      public static Map<String,Object> unwrap(org.json.JSONObject jsonObject) throws org.json.JSONException
      Parameters:
      jsonObject -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> T unwrap(Class<? extends T> cls, org.json.JSONObject jsonObject) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      cls -
      jsonObject -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> T unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONObject jsonObject) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      type -
      jsonObject -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> List<T> unwrap(org.json.JSONArray jsonArray) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      jsonArray -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> List<T> unwrap(org.json.JSONArray jsonArray, Class<T> elementClass) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      jsonArray -
      elementClass -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> List<T> unwrap(org.json.JSONArray jsonArray, com.landawn.abacus.type.Type<T> elementType) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      jsonArray -
      elementType -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> T unwrap(Class<? extends T> cls, org.json.JSONArray jsonArray) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      cls - array or collection class
      jsonArray -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception
    • unwrap

      public static <T> T unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONArray jsonArray) throws org.json.JSONException
      Type Parameters:
      T -
      Parameters:
      type -
      jsonArray -
      Returns:
      Throws:
      org.json.JSONException - the JSON exception