Interface JSON


public interface JSON
  • Field Details

  • Method Details

    • parse

      static Object parse(String text)
      Parse JSON String into JSONArray or JSONObject
      Parameters:
      text - the JSON String to be parsed
      Returns:
      Object
    • parse

      static Object parse(String text, JSONReader.Feature... features)
      Parse JSON String into JSONArray or JSONObject with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      features - features to be enabled in parsing
      Returns:
      Object
    • parse

      static Object parse(String text, int offset, int length, JSONReader.Feature... features)
      Parse JSON String into JSONArray or JSONObject with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      features - features to be enabled in parsing
      Returns:
      Object
    • parse

      static Object parse(String text, JSONReader.Context context)
      Parse JSON String into JSONArray or JSONObject with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      context - specify the context use by JSONReader
      Returns:
      Object
    • parse

      static Object parse(byte[] bytes, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into JSONArray or JSONObject with specified JSONReader.Features enabled
      Parameters:
      bytes - the UTF8 Bytes to be parsed
      features - features to be enabled in parsing
      Returns:
      Object
    • parse

      static Object parse(char[] chars, JSONReader.Feature... features)
      Parse JSON char array into JSONArray or JSONObject with specified JSONReader.Features enabled
      Parameters:
      chars - the char array to be parsed
      features - features to be enabled in parsing
      Returns:
      Object
    • parseObject

      static JSONObject parseObject(String text)
      Parse JSON String into JSONObject
      Parameters:
      text - the JSON String to be parsed
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(String text, JSONReader.Feature... features)
      Parse JSON String into JSONObject
      Parameters:
      text - the JSON String to be parsed
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(String text, int offset, int length, JSONReader.Feature... features)
      Parse JSON String into JSONObject
      Parameters:
      text - the JSON String to be parsed
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(String text, JSONReader.Context context)
      Parse JSON String into JSONObject
      Parameters:
      text - the JSON String to be parsed
      context - specify the context use by JSONReader
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(Reader input, JSONReader.Feature... features)
      Parse Reader into into JSONObject
      Parameters:
      input - the JSON InputStream to be parsed
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(InputStream input, JSONReader.Feature... features)
      Parse UTF8 inputStream into into JSONObject
      Parameters:
      input - the JSON InputStream to be parsed
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(byte[] bytes)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(char[] chars)
      Parse JSON char array into JSONObject
      Parameters:
      chars - JSON char array to parse
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(InputStream in, Charset charset)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      in - the JSON InputStream to be parsed
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(URL url)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      url - the JSON URL to be parsed
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(byte[] bytes, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(byte[] bytes, int offset, int length, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(char[] chars, int offset, int length, JSONReader.Feature... features)
      Parse JSON char array into JSONObject
      Parameters:
      chars - JSON char array to parse
      offset - the index of the first byte to parse
      length - the number of chars to parse
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static JSONObject parseObject(byte[] bytes, int offset, int length, Charset charset, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into JSONObject
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      charset - specify Charset to parse
      features - features to be enabled in parsing
      Returns:
      JSONObject
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      clazz - specify the Class to be converted
      Returns:
      Class
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, Filter filter, JSONReader.Feature... features)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      clazz - specify the Class to be converted
      filter - specify filter to be enabled
      features - features to be enabled in parsing
      Returns:
      Class
    • parseObject

      static <T> T parseObject(String text, Type type, String format, Filter[] filters, JSONReader.Feature... features)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
      format - the specified date format
      filters - specify filters to be enabled
      features - features to be enabled in parsing
      Returns:
      Class
    • parseObject

      static <T> T parseObject(String text, Type type)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
    • parseObject

      static <T> T parseObject(String text, Type... types)
    • parseObject

      static <T> T parseObject(String text, TypeReference typeReference, JSONReader.Feature... features)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      typeReference - specify the TypeReference to be converted
    • parseObject

      static <T> T parseObject(String text, TypeReference typeReference, Filter filter, JSONReader.Feature... features)
      Parse JSON String into Java Object
      Parameters:
      text - the JSON String to be parsed
      typeReference - specify the TypeReference to be converted
      filter - specify filters to be enabled
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      clazz - specify the Class to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(String text, int offset, int length, Class<T> clazz, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      clazz - specify the Class to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, JSONReader.Context context)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      clazz - specify the Class to be converted
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, String format, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      clazz - specify the Class to be converted
      format - the specified date format
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(String text, Type type, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(String text, Type type, Filter filter, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
      filter - specify filters to be enabled
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(String text, Type type, String format, JSONReader.Feature... features)
      Parse JSON String into a Java object with specified JSONReader.Features enabled
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
      format - the specified date format
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(char[] chars, int offset, int length, Type type, JSONReader.Feature... features)
      Parse JSON char array into a Java object with specified JSONReader.Features enabled
      Parameters:
      chars - JSON char array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      type - specify the Type to be converted
      features - features to be enabled in parsing
      Since:
      2.0.13
    • parseObject

      static <T> T parseObject(char[] chars, Class<T> clazz)
      Parse JSON char array into a Java object
      Parameters:
      chars - JSON char array to parse
      clazz - specify the Class to be converted
      Since:
      2.0.13
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Type type, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      type - specify the Type to be converted
      features - features to be enabled in parsing
      Since:
      2.0.13
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      clazz - specify the Class to be converted
    • parseObject

      static <T> T parseObject(byte[] utf8Bytes, Class<T> clazz, Filter filter, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      utf8Bytes - UTF8 encoded JSON byte array to parse
      clazz - specify the Class to be converted
      filter - specify filter to be enabled
      features - features to be enabled in parsing
      Returns:
      Class
    • parseObject

      static <T> T parseObject(byte[] utf8Bytes, Class<T> clazz, JSONReader.Context context)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      utf8Bytes - UTF8 encoded JSON byte array to parse
      clazz - specify the Class to be converted
      context - specify the context use by JSONReader
      Returns:
      Class
    • parseObject

      static <T> T parseObject(byte[] utf8Bytes, Type type, String format, Filter[] filters, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object
      Parameters:
      utf8Bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
      format - the specified date format
      filters - specify filters to be enabled
      features - features to be enabled in parsing
      Returns:
      Class
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      clazz - specify the Class to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, Filter filter, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
      filter - specify filters to be enabled
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, String format, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into a Java object with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
      format - the specified date format
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(Reader input, Type type, JSONReader.Feature... features)
      Parse Reader into a Java object with specified JSONReader.Features enabled
      Parameters:
      input - the JSON InputStream to be parsed
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(InputStream input, Type type, JSONReader.Feature... features)
      Parse UTF8 inputStream into a Java object with specified JSONReader.Features enabled
      Parameters:
      input - the JSON InputStream to be parsed
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(URL url, Type type, JSONReader.Feature... features)
      Parse UTF8 URL Resource into a Java object with specified JSONReader.Features enabled
      Parameters:
      url - the JSON URL to be parsed
      type - specify the Type to be converted
      features - features to be enabled in parsing
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
      Since:
      2.0.4
    • parseObject

      static <T> T parseObject(URL url, Class<T> objectClass, JSONReader.Feature... features)
      Parse UTF8 URL Resource into a Java object with specified JSONReader.Features enabled
      Parameters:
      url - the JSON URL to be parsed
      objectClass - specify the Class to be converted
      features - features to be enabled in parsing
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
      Since:
      2.0.9
    • parseObject

      static <T> T parseObject(URL url, Function<JSONObject,T> function, JSONReader.Feature... features)
      Parse UTF8 URL Resource into a Java object with specified JSONReader.Features enabled
      Parameters:
      url - the JSON URL to be parsed
      function - specify the Function to be converted
      features - features to be enabled in parsing
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
      Since:
      2.0.4
    • parseObject

      static <T> T parseObject(InputStream input, Type type, String format, JSONReader.Feature... features)
      Parse UTF8 inputStream into a Java object with specified JSONReader.Features enabled
      Parameters:
      input - the JSON InputStream to be parsed
      type - specify the Type to be converted
      format - the specified date format
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(InputStream input, Charset charset, Type type, JSONReader.Feature... features)
      Parse UTF8 inputStream into a Java object with specified JSONReader.Features enabled
      Parameters:
      input - the JSON InputStream to be parsed
      charset - inputStream charset
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Charset charset, Type type)
      Parses the JSON byte array of the specified Charset into a Java Object
      Parameters:
      bytes - JSON byte array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      charset - specify Charset to parse
      type - specify the Type to be converted
      Throws:
      IndexOutOfBoundsException - If the offset and the length arguments index characters outside the bounds of the bytes array
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Charset charset, Class<T> type, JSONReader.Feature... features)
      Parses the JSON byte array of the specified Charset into a Java Object
      Parameters:
      bytes - JSON byte array to parse
      offset - the index of the first byte to parse
      length - the number of bytes to parse
      charset - specify Charset to parse
      type - specify the Class to be converted
      features - features to be enabled in parsing
      Throws:
      IndexOutOfBoundsException - If the offset and the length arguments index characters outside the bounds of the bytes array
    • parseObject

      static <T> void parseObject(InputStream input, Type type, Consumer<T> consumer, JSONReader.Feature... features)
      Parse InputStream into a Java object with specified JSONReader.Features enabled and consume it
      Parameters:
      input - the JSON InputStream to be parsed
      type - specify the Type to be converted
      consumer - the consumer of the parsing result object
      features - features to be enabled in parsing
      Throws:
      JSONException - If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs
      Since:
      2.0.2
      See Also:
    • parseObject

      static <T> void parseObject(InputStream input, Charset charset, char delimiter, Type type, Consumer<T> consumer, JSONReader.Feature... features)
      Parse InputStream into a Java object with specified JSONReader.Features enabled and consume it
      Parameters:
      input - the JSON InputStream to be parsed
      charset - specify Charset to parse
      delimiter - specify the delimiter
      type - specify the Type to be converted
      consumer - the consumer of the parsing result object
      features - features to be enabled in parsing
      Throws:
      JSONException - If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs
      Since:
      2.0.2
    • parseObject

      static <T> void parseObject(Reader input, char delimiter, Type type, Consumer<T> consumer)
      Parse Reader into a Java object with specified JSONReader.Features enabled and consume it
      Parameters:
      input - the JSON Reader to be parsed
      delimiter - specify the delimiter
      type - specify the Type to be converted
      consumer - the consumer of the parsing result object
      Throws:
      JSONException - If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs
      Since:
      2.0.2
    • parseArray

      static JSONArray parseArray(String text)
      Parse JSON String into JSONArray
      Parameters:
      text - the JSON String to be parsed
    • parseArray

      static JSONArray parseArray(byte[] bytes)
      Parse JSON String into JSONArray
      Parameters:
      bytes - the JSON String to be parsed
    • parseArray

      static JSONArray parseArray(byte[] bytes, int offset, int length, Charset charset)
      Parse JSON String into JSONArray
      Parameters:
      bytes - the JSON String to be parsed
      offset - the index of the first byte to validate
      length - the number of bytes to validate
      charset - specify Charset to validate
      Since:
      2.0.13
    • parseArray

      static JSONArray parseArray(char[] chars)
      Parse JSON String into JSONArray
      Parameters:
      chars - the JSON String to be parsed
    • parseArray

      static JSONArray parseArray(String text, JSONReader.Feature... features)
      Parse JSON String into JSONArray
      Parameters:
      text - the JSON String to be parsed
      features - features to be enabled in parsing
    • parseArray

      static JSONArray parseArray(URL url, JSONReader.Feature... features)
      Parse JSON InputStream into JSONArray
      Parameters:
      url - the JSON URL to be parsed
      features - features to be enabled in parsing
    • parseArray

      static JSONArray parseArray(InputStream in, JSONReader.Feature... features)
      Parse JSON InputStream into JSONArray
      Parameters:
      in - the JSON InputStream to be parsed
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(String text, Type type, JSONReader.Feature... features)
      Parse JSON String into List
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(String text, Type type)
      Parse JSON String into List
      Parameters:
      text - the JSON String to be parsed
      type - specify the Type to be converted
    • parseArray

      static <T> List<T> parseArray(String text, Type... types)
      Parse JSON String into List
      Parameters:
      text - the JSON String to be parsed
      types - specify the Type to be converted
    • parseArray

      static <T> List<T> parseArray(String text, Class<T> type, JSONReader.Feature... features)
      Parse JSON String into List
      Parameters:
      text - the JSON String to be parsed
      type - specify the Class to be converted
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(char[] chars, Class<T> type, JSONReader.Feature... features)
      Parse JSON String into List
      Parameters:
      chars - the JSON String to be parsed
      type - specify the Class to be converted
      features - features to be enabled in parsing
      Since:
      2.0.13
    • parseArray

      static <T> List<T> parseArray(String text, Type[] types, JSONReader.Feature... features)
      Parse JSON String into List
      Parameters:
      text - the JSON String to be parsed
      types - specify some Types to be converted
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, Type type, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into List with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Type to be converted
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, Class<T> type, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into List with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      type - specify the Class to be converted
      features - features to be enabled in parsing
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, int offset, int length, Charset charset, Class<T> type, JSONReader.Feature... features)
      Parse UTF8 encoded JSON byte array into List with specified JSONReader.Features enabled
      Parameters:
      bytes - UTF8 encoded JSON byte array to parse
      offset - the index of the first byte to validate
      length - the number of bytes to validate
      charset - specify Charset to validate
      type - specify the Class to be converted
      features - features to be enabled in parsing
    • toJSONString

      static String toJSONString(Object object)
      Serialize Java Object to JSON String
      Parameters:
      object - Java Object to be serialized into JSON String
    • toJSONString

      static String toJSONString(Object object, JSONWriter.Context context)
      Serialize Java Object to JSON String
      Parameters:
      object - Java Object to be serialized into JSON String
      context -
    • toJSONString

      static String toJSONString(Object object, JSONWriter.Feature... features)
      Serialize Java Object to JSON String with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON String
      features - features to be enabled in serialization
    • toJSONString

      static String toJSONString(Object object, Filter filter, JSONWriter.Feature... features)
      Serialize Java Object to JSON String with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON String
      filter - specify a filter to use in serialization
      features - features to be enabled in serialization
    • toJSONString

      static String toJSONString(Object object, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON String with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON String
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
    • toJSONString

      static String toJSONString(Object object, String format, JSONWriter.Feature... features)
      Serialize Java Object to JSON String with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON String
      format - the specified date format
      features - features to be enabled in serialization
    • toJSONString

      static String toJSONString(Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON String with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON String
      format - the specified date format
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
    • toJSONBytes

      static byte[] toJSONBytes(Object object)
      Serialize Java Object to JSON byte array
      Parameters:
      object - Java Object to be serialized into JSON byte array
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Filter... filters)
      Serialize Java Object to JSON byte array
      Parameters:
      object - Java Object to be serialized into JSON byte array
      filters - specifies the filter to use in serialization
    • toJSONBytes

      static byte[] toJSONBytes(Object object, JSONWriter.Feature... features)
      Serialize Java Object to JSON byte array with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON byte array
      features - features to be enabled in serialization
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON byte array with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON byte array
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
    • toJSONBytes

      static byte[] toJSONBytes(Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON byte array with specified JSONReader.Features enabled
      Parameters:
      object - Java Object to be serialized into JSON byte array
      format - the specified date format
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
    • writeTo

      static int writeTo(OutputStream out, Object object, JSONWriter.Feature... features)
      Serialize Java Object to JSON and write to OutputStream with specified JSONReader.Features enabled
      Parameters:
      out - OutputStream to be written
      object - Java Object to be serialized into JSON
      features - features to be enabled in serialization
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
    • writeTo

      static int writeTo(OutputStream out, Object object, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON and write to OutputStream with specified JSONReader.Features enabled
      Parameters:
      out - OutputStream to be written
      object - Java Object to be serialized into JSON
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
    • writeTo

      static int writeTo(OutputStream out, Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serialize Java Object to JSON and write to OutputStream with specified JSONReader.Features enabled
      Parameters:
      out - OutputStream to be written
      object - Java Object to be serialized into JSON
      format - the specified date format
      filters - specifies the filter to use in serialization
      features - features to be enabled in serialization
      Throws:
      JSONException - if an I/O error occurs. In particular, a JSONException may be thrown if the output stream has been closed
    • isValid

      static boolean isValid(String text)
      Verify the String is JSON
      Parameters:
      text - the String to validate
      Returns:
      true or false
    • isValid

      static boolean isValid(char[] chars)
      Verify the char array is JSON
      Parameters:
      chars - the String to validate
      Returns:
      true or false
    • isValidObject

      static boolean isValidObject(String text)
      Verify the String is JSON Object
      Parameters:
      text - the String to validate
      Returns:
      true or false
    • isValidObject

      static boolean isValidObject(byte[] bytes)
      Verify the byte array is JSON Object
      Parameters:
      bytes - the byte array to validate
      Returns:
      true or false
    • isValidArray

      static boolean isValidArray(String text)
      Verify the String is JSON Array
      Parameters:
      text - the String to validate
      Returns:
      true or false
    • isValid

      static boolean isValid(byte[] bytes)
      Verify the byte array is JSON Object
      Parameters:
      bytes - the byte array to validate
      Returns:
      true or false
    • isValidArray

      static boolean isValidArray(byte[] bytes)
      Verify the byte array is JSON Array
      Parameters:
      bytes - the byte array to validate
      Returns:
      true or false
    • isValid

      static boolean isValid(byte[] bytes, int offset, int length, Charset charset)
      Verify the byte array is JSON Object
      Parameters:
      bytes - the byte array to validate
      offset - the index of the first byte to validate
      length - the number of bytes to validate
      charset - specify Charset to validate
      Returns:
      true or false
    • toJSON

      static Object toJSON(Object object)
      Convert Java object order to JSONArray or JSONObject
      Parameters:
      object - Java Object to be converted
      Returns:
      Java Object
    • toJSON

      static Object toJSON(Object object, JSONWriter.Feature... features)
      Convert Java object order to JSONArray or JSONObject
      Parameters:
      object - Java Object to be converted
      Returns:
      Java Object
    • to

      static <T> T to(Class<T> clazz, Object object)
      Convert the Object to the target type
      Parameters:
      clazz - converted goal class
      object - Java Object to be converted
      Since:
      2.0.4
    • toJavaObject

      static <T> T toJavaObject(Object object, Class<T> clazz)
      Deprecated.
      since 2.0.4, please use to(Class, Object)
      Convert the Object to the target type
      Parameters:
      object - Java Object to be converted
      clazz - converted goal class
    • mixIn

      static void mixIn(Class<?> target, Class<?> mixinSource)
      Since:
      2.0.2
    • register

      static ObjectReader<?> register(Type type, ObjectReader<?> objectReader)
      Register an ObjectReader for Type in default ObjectReaderProvider
      Since:
      2.0.2
      See Also:
    • registerIfAbsent

      static ObjectReader<?> registerIfAbsent(Type type, ObjectReader<?> objectReader)
      Register if absent an ObjectReader for Type in default ObjectReaderProvider
      Since:
      2.0.6
      See Also:
    • register

      static boolean register(ObjectReaderModule objectReaderModule)
      See Also:
    • register

      static boolean register(ObjectWriterModule objectWriterModule)
      See Also:
    • register

      static ObjectWriter<?> register(Type type, ObjectWriter<?> objectWriter)
      Register an ObjectWriter for Type in default ObjectWriterProvider
      Since:
      2.0.2
      See Also:
    • registerIfAbsent

      static ObjectWriter<?> registerIfAbsent(Type type, ObjectWriter<?> objectWriter)
      Register if absent an ObjectWriter for Type in default ObjectWriterProvider
      Since:
      2.0.6
      See Also:
    • register

      static void register(Class type, Filter filter)
      Register ObjectWriterFilter
      Parameters:
      type -
      filter -
      Since:
      2.0.19
    • config

      static void config(JSONReader.Feature... features)
      Enable the specified features in default reader
      Parameters:
      features - the specified features to be used
      Since:
      2.0.6
    • config

      static void config(JSONReader.Feature feature, boolean state)
      Enable or disable the specified features in default reader
      Parameters:
      feature - the specified feature to be used
      state - enable this feature if and only if state is true, disable otherwise
      Since:
      2.0.6
    • isEnabled

      static boolean isEnabled(JSONReader.Feature feature)
      Check if the default reader enables the specified feature
      Parameters:
      feature - the specified feature
      Since:
      2.0.6
    • config

      static void config(JSONWriter.Feature... features)
      Enable the specified features in default writer
      Parameters:
      features - the specified features to be used
      Since:
      2.0.6
    • config

      static void config(JSONWriter.Feature feature, boolean state)
      Enable or disable the specified features in default writer
      Parameters:
      feature - the specified feature to be used
      state - enable this feature if and only if state is true, disable otherwise
      Since:
      2.0.6
    • isEnabled

      static boolean isEnabled(JSONWriter.Feature feature)
      Check if the default writer enables the specified feature
      Parameters:
      feature - the specified feature
      Since:
      2.0.6
    • copy

      static <T> T copy(T object, JSONWriter.Feature... features)
      use ObjectWriter and ObjectReader copy java object
      Parameters:
      object - the object to be copy
      features - the specified features
      Since:
      2.0.12
    • copyTo

      static <T> T copyTo(Object object, Class<T> targetClass, JSONWriter.Feature... features)
      use ObjectWriter and ObjectReader copy java object
      Parameters:
      object - the object to be copy
      targetClass - target class
      features - the specified features
      Since:
      2.0.16