Interface JSON


public interface JSON
  • Field Details

  • Method Details

    • parse

      static Object parse(String text)
      Parses the json string as a JSONArray or JSONObject. Returns null if received String is null or empty.
      Parameters:
      text - the specified text to be parsed
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parse

      static Object parse(String text, JSONReader.Feature... features)
      Parses the json string as a JSONArray or JSONObject. Returns null if received String is null or empty.
      Parameters:
      text - the specified text to be parsed
      features - the specified features is applied to parsing
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parse

      static Object parse(String text, int offset, int length, JSONReader.Feature... features)
      Parses the json string as a JSONArray or JSONObject. Returns null if received String is null or empty or length is 0.
      Parameters:
      text - the specified text to be parsed
      offset - the starting index of string
      length - the specified length of string
      features - the specified features is applied to parsing
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parse

      static Object parse(String text, JSONReader.Context context)
      Parses the json string as a JSONArray or JSONObject. Returns null if received String is null or empty.
      Parameters:
      text - the specified text to be parsed
      context - the specified custom context
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
    • parse

      static Object parse(byte[] bytes, JSONReader.Feature... features)
      Parses the json byte array as a JSONArray or JSONObject. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      features - the specified features is applied to parsing
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parse

      static Object parse(byte[] bytes, JSONReader.Context context)
      Parses the json byte array as a JSONArray or JSONObject. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      context - the specified custom context
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.51
    • parse

      static Object parse(byte[] bytes, int offset, int length, Charset charset, JSONReader.Context context)
      Parses the json byte array as a JSONArray or JSONObject. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      context - the specified custom context
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.51
    • parse

      static Object parse(char[] chars, JSONReader.Feature... features)
      Parses the json char array as a JSONArray or JSONObject. Returns null if received char array is null or empty.
      Parameters:
      chars - the specified char array to be parsed
      features - the specified features is applied to parsing
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parse

      static Object parse(char[] chars, JSONReader.Context context)
      Parses the json char array as a JSONArray or JSONObject. Returns null if received char array is null or empty.
      Parameters:
      chars - the specified char array to be parsed
      context - the specified custom context
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.51
    • parse

      static Object parse(InputStream in, JSONReader.Context context)
      Parses the json stream as a JSONArray or JSONObject. Returns null if received String is null or empty.
      Parameters:
      in - the specified stream to be parsed
      context - the specified custom context
      Returns:
      either JSONArray or JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
      Since:
      2.0.47
    • parseObject

      static JSONObject parseObject(String text)
      Parses the json string as a JSONObject. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(String text, JSONReader.Feature... features)
      Parses the json string as a JSONObject. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(String text, int offset, int length, JSONReader.Feature... features)
      Parses the json string as a JSONObject. Returns null if received String is null or empty or length is 0 or its content is null.
      Parameters:
      text - the specified text to be parsed
      offset - the starting index of string
      length - the specified length of string
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(String text, int offset, int length, JSONReader.Context context)
      Parses the json string as a JSONObject. Returns null if received String is null or empty or length is 0 or its content is null.
      Parameters:
      text - the specified text to be parsed
      offset - the starting index of string
      length - the specified length of string
      context - the specified custom context
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
      Since:
      2.0.30
    • parseObject

      static JSONObject parseObject(String text, JSONReader.Context context)
      Parses the json string as a JSONObject. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      context - the specified custom context
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
    • parseObject

      static JSONObject parseObject(Reader input, JSONReader.Feature... features)
      Parses the json reader as a JSONObject. Returns null if received Reader is null or its content is null.
      Parameters:
      input - the specified reader to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(InputStream input, JSONReader.Feature... features)
      Parses the json stream as a JSONObject. Returns null if received InputStream is null or closed or its content is null.
      Parameters:
      input - the specified stream to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(byte[] bytes)
      Parses the json byte array as a JSONObject. Returns null if received byte array is null or empty or its content is null.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(char[] chars)
      Parses the json char array as a JSONObject. Returns null if received char array is null or empty or its content is null.
      Parameters:
      chars - the specified char array to be parsed
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(InputStream in, Charset charset)
      Parses the json stream as a JSONObject. Returns null if received InputStream is null or its content is null.
      Parameters:
      in - the specified stream to be parsed
      charset - the specified charset of the stream
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(InputStream input, Charset charset, JSONReader.Context context)
      Parses the json stream as a JSONObject. Returns null if received InputStream is null or closed or its content is null.
      Parameters:
      input - the specified stream to be parsed
      charset - the specified charset of the stream
      context - the specified custom context
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.47
    • parseObject

      static JSONObject parseObject(URL url)
      Parses the json stream of the url as a JSONObject. Returns null if received URL is null.
      Parameters:
      url - the specified url to be parsed
      Returns:
      JSONObject or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
      See Also:
    • parseObject

      static JSONObject parseObject(byte[] bytes, JSONReader.Feature... features)
      Parses the json byte array as a JSONObject. Returns null if received byte array is null or empty or its content is null.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(byte[] bytes, int offset, int length, JSONReader.Feature... features)
      Parses the json byte array as a JSONObject. Returns null if received byte array is null or empty or length is 0 or its content is null.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(char[] chars, int offset, int length, JSONReader.Feature... features)
      Parses the json chars array as a JSONObject. Returns null if received chars array is null or empty or length is 0 or its content is null.
      Parameters:
      chars - the specified chars array to be parsed
      offset - the starting index of array
      length - the specified length of array
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static JSONObject parseObject(byte[] bytes, int offset, int length, Charset charset, JSONReader.Feature... features)
      Parses the json byte array as a JSONObject. Returns null if received byte array is null or empty or length is 0 or its content is null.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      features - the specified features is applied to parsing
      Returns:
      JSONObject or null
      Throws:
      JSONException - If a parsing error occurs
      See Also:
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      clazz - the specified class of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, Filter filter, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      clazz - the specified class of JSON
      filter - the specified filter is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Type type, String format, Filter[] filters, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type of JSON
      format - the specified date format
      filters - the specified filters is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Type type)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T extends Map<String, Object>> T parseObject(String text, MapMultiValueType<T> type)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.34
    • parseObject

      static <T> T parseObject(String text, Type... types)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      types - the specified actual parameter types
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      See Also:
    • parseObject

      static <T> T parseObject(String text, TypeReference<T> typeReference, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      typeReference - the specified actual type
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, TypeReference<T> typeReference, Filter filter, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      typeReference - the specified actual type
      filter - the specified filter is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      clazz - the specified class of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, int offset, int length, Class<T> clazz, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty or length is 0.
      Parameters:
      text - the specified string to be parsed
      offset - the starting index of string
      length - the specified length of string
      clazz - the specified class of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, JSONReader.Context context)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      clazz - the specified class of JSON
      context - the specified custom context
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
    • parseObject

      static <T> T parseObject(String text, Class<T> clazz, String format, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      clazz - the specified class of JSON
      format - the specified date format
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Type type, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Type type, Filter filter, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type
      filter - the specified filter is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(String text, Type type, String format, JSONReader.Feature... features)
      Parses the json string as JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type
      format - the specified date format
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(char[] chars, int offset, int length, Type type, JSONReader.Feature... features)
      Parses the json char array as JSON. Returns null if received char array is null or empty or length is 0.
      Parameters:
      chars - the specified char array to be parsed
      type - the specified actual type
      offset - the starting index of array
      length - the specified length of array
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.13
    • parseObject

      static <T> T parseObject(char[] chars, Class<T> clazz)
      Parses the json char array as JSON. Returns null if received char array is null or empty.
      Parameters:
      chars - the specified char array to be parsed
      clazz - the specified class of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Type type, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty or length is 0.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      type - the specified actual type
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.13
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      clazz - the specified class of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz, Filter filter, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      clazz - the specified class of JSON
      filter - the specified filter is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz, JSONReader.Context context)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      clazz - the specified class of JSON
      context - the specified custom context
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
      NullPointerException - If received context is null
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, String format, Filter[] filters, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type
      format - the specified date format
      filters - the specified filters is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Class<T> clazz, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      clazz - the specified class of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(char[] chars, Class<T> objectClass, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      chars - the specified chars
      objectClass - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(char[] chars, Type type, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      chars - the specified chars
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, Filter filter, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type of JSON
      filter - the specified filter is applied to parsing
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, Type type, String format, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type of JSON
      format - the specified date format
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(ByteBuffer buffer, Class<T> objectClass)
      Parses the json byte buffer as a JSON. Returns null if received ByteBuffer is null.
      Parameters:
      buffer - the specified buffer to be parsed
      objectClass - the specified class of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(Reader input, Type type, JSONReader.Feature... features)
      Parses the json reader as a JSON. Returns null if received Reader is null or its content is null.
      Parameters:
      input - the specified reader to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(InputStream input, Type type, JSONReader.Feature... features)
      Parses the json stream as a JSON. Returns null if received InputStream is null or its content is null.
      Parameters:
      input - the specified stream to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(InputStream input, Charset charset, Type type, JSONReader.Context context)
      Parses the json stream as a JSON. Returns null if received InputStream is null or its content is null.
      Parameters:
      input - the specified stream to be parsed
      type - the specified actual type of JSON
      context - the specified custom context
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(InputStream input, Charset charset, Class<T> type, JSONReader.Context context)
      Parses the json stream as a JSON. Returns null if received InputStream is null or its content is null.
      Parameters:
      input - the specified stream to be parsed
      type - the specified actual type of JSON
      context - the specified custom context
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(URL url, Type type, JSONReader.Feature... features)
      Parses the json stream of the url as JSON. Returns null if received URL is null.
      Parameters:
      url - the specified url to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
      Since:
      2.0.4
      See Also:
    • parseObject

      static <T> T parseObject(URL url, Class<T> objectClass, JSONReader.Feature... features)
      Parses the json stream of the url as JSON. Returns null if received URL is null.
      Parameters:
      url - the specified url to be parsed
      objectClass - the specified class of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
      Since:
      2.0.9
      See Also:
    • parseObject

      static <T> T parseObject(URL url, Function<JSONObject,T> function, JSONReader.Feature... features)
      Parses the json stream of the url as a JSONObject and call the function to convert it to JSON. Returns null if received URL is null.
      Parameters:
      url - the specified url to be parsed
      function - the specified converter
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
      Since:
      2.0.4
      See Also:
    • parseObject

      static <T> T parseObject(InputStream input, Type type, String format, JSONReader.Feature... features)
      Parses the json stream as a JSON. Returns null if received InputStream is null or its content is null.
      Parameters:
      input - the specified stream to be parsed
      type - the specified actual type of JSON
      format - the specified date format
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(InputStream input, Charset charset, Type type, JSONReader.Feature... features)
      Parses the json stream as a JSON. Returns null if received InputStream is null or its content is null.
      Parameters:
      input - the specified stream to be parsed
      charset - the specified charset of the stream
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Charset charset, Type type)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty or length is 0.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      type - the specified actual type of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Charset charset, Class<T> type)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty or length is 0.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      type - the specified actual type of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> T parseObject(byte[] bytes, int offset, int length, Charset charset, Class<T> type, JSONReader.Feature... features)
      Parses the json byte array as JSON. Returns null if received byte array is null or empty or length is 0.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      type - the specified actual class of JSON
      Returns:
      JSON or null
      Throws:
      JSONException - If a parsing error occurs
    • parseObject

      static <T> void parseObject(InputStream input, Type type, Consumer<T> consumer, JSONReader.Feature... features)
      Parses the json stream through the specified delimiter as JSON objects and call the specified consumer to consume it
      Parameters:
      input - the specified stream to be parsed
      type - the specified actual class of JSON
      consumer - the specified consumer is called multiple times
      features - the specified features is applied to parsing
      Throws:
      JSONException - If an I/O error or parsing error occurs
      NullPointerException - If the specified stream is null
      Since:
      2.0.2
    • parseObject

      static <T> void parseObject(InputStream input, Charset charset, char delimiter, Type type, Consumer<T> consumer, JSONReader.Feature... features)
      Parses the json stream through the specified delimiter as JSON objects and call the specified consumer to consume it
      Parameters:
      input - the specified stream to be parsed
      charset - the specified charset of the stream
      type - the specified actual class of JSON
      delimiter - the specified delimiter for the stream
      consumer - the specified consumer is called multiple times
      features - the specified features is applied to parsing
      Throws:
      JSONException - If an I/O error or parsing error occurs
      NullPointerException - If the specified stream is null
      Since:
      2.0.2
    • parseObject

      static <T> void parseObject(Reader input, char delimiter, Type type, Consumer<T> consumer)
      Parses the json reader through the specified delimiter as JSON objects and call the specified consumer to consume it
      Parameters:
      input - the specified reader to be parsed
      type - the specified actual class of JSON
      delimiter - the specified delimiter for the stream
      consumer - the specified consumer is called multiple times
      Throws:
      JSONException - If an I/O error or parsing error occurs
      NullPointerException - If the specified reader is null
      Since:
      2.0.2
    • parseArray

      static JSONArray parseArray(String text)
      Parses the json string as a JSONArray. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      Returns:
      JSONArray or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static JSONArray parseArray(byte[] bytes)
      Parses the json byte array as a JSONArray. Returns null if received byte array is null or empty or its content is null.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      Returns:
      JSONArray or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static JSONArray parseArray(byte[] bytes, int offset, int length, Charset charset)
      Parses the json byte array as a JSONArray. Returns null if received byte array is null or empty or length is 0 or its content is null.
      Parameters:
      bytes - the specified byte array to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      Throws:
      JSONException - If a parsing error occurs
      Since:
      2.0.13
    • parseArray

      static JSONArray parseArray(char[] chars)
      Parses the json char array as a JSONArray. Returns null if received byte array is null or empty or its content is null.
      Parameters:
      chars - the specified char array to be parsed
      Returns:
      JSONArray or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static JSONArray parseArray(String text, JSONReader.Feature... features)
      Parses the json string as a JSONArray. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONArray or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static JSONArray parseArray(URL url, JSONReader.Feature... features)
      Parses the json stream of the url as a JSONArray. Returns null if received URL is null.
      Parameters:
      url - the specified url to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONArray or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
      See Also:
    • parseArray

      static JSONArray parseArray(InputStream in, JSONReader.Feature... features)
      Parses the json stream as a JSONArray. Returns null if received InputStream is null or its content is null.
      Parameters:
      in - the specified stream to be parsed
      features - the specified features is applied to parsing
      Returns:
      JSONArray or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
    • parseArray

      static JSONArray parseArray(InputStream in, Charset charset, JSONReader.Context context)
      Parses the json stream as a JSONArray. Returns null if received InputStream is null or its content is null.
      Parameters:
      in - the specified stream to be parsed
      charset - the specified charset of the stream
      context - the specified custom context
      Returns:
      JSONArray or null
      Throws:
      JSONException - If an I/O error or parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Type type, JSONReader.Feature... features)
      Parses the json string as a list of JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Type type)
      Parses the json string as a list of JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual type of JSON
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Class<T> type)
      Parses the json string as a list of JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual class of JSON
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Type... types)
      Parses the json string as a list of JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      types - the specified actual parameter type
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Class<T> type, JSONReader.Feature... features)
      Parses the json string as a list of JSON. Returns null if received String is null or empty.
      Parameters:
      text - the specified string to be parsed
      type - the specified actual class of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(char[] chars, Class<T> type, JSONReader.Feature... features)
      Parses the json char array as a list of JSON. Returns null if received char array is null or empty.
      Parameters:
      chars - the specified char array to be parsed
      type - the specified actual class of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(String text, Type[] types, JSONReader.Feature... features)
      Parses the json string as a list of JSON. Returns null if received String is null or empty or its content is null.
      Parameters:
      text - the specified string to be parsed
      types - the specified actual parameter type
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, Type type, JSONReader.Feature... features)
      Parses the json byte array as a list of JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual type of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, Class<T> type, JSONReader.Feature... features)
      Parses the json byte array as a list of JSON. Returns null if received byte array is null or empty.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      type - the specified actual class of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • parseArray

      static <T> List<T> parseArray(byte[] bytes, int offset, int length, Charset charset, Class<T> type, JSONReader.Feature... features)
      Parses the json byte array as a list of JSON. Returns null if received byte array is null or empty or the specified length is 0.
      Parameters:
      bytes - the specified UTF8 text to be parsed
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the stream
      type - the specified actual class of JSON
      features - the specified features is applied to parsing
      Returns:
      List or null
      Throws:
      JSONException - If a parsing error occurs
    • toJSONString

      static String toJSONString(Object object)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, JSONWriter.Context context)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      context - the specified custom context
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, JSONWriter.Feature... features)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      features - the specified features is applied to serialization
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, Filter filter, JSONWriter.Feature... features)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      filter - the specified filter is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, String format, JSONWriter.Feature... features)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      format - the specified date format
      features - the specified features is applied to serialization
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONString

      static String toJSONString(Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json string
      Parameters:
      object - the specified object will be serialized
      format - the specified date format
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      String that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Charset charset, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      charset - the specified charset of the bytes
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
      Since:
      2.0.47
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Charset charset, JSONWriter.Context context)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      charset - the specified charset of the bytes
      context - the specified custom context
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
      Since:
      2.0.47
    • toJSONBytes

      static byte[] toJSONBytes(Object object, String format, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      format - the specified date format
      features - the specified features is applied to serialization
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Filter... filters)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      filters - the specified filters is applied to serialization
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      features - the specified features is applied to serialization
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • toJSONBytes

      static byte[] toJSONBytes(Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array
      Parameters:
      object - the specified object will be serialized
      format - the specified date format
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      byte[] that is not null
      Throws:
      JSONException - If a serialization error occurs
    • writeTo

      static int writeTo(OutputStream out, Object object)
      Serializes the specified object to the json byte array and write it to OutputStream
      Parameters:
      out - the specified output stream to be written
      object - the specified object will be serialized
      Returns:
      the length of byte stream
      Throws:
      JSONException - If an I/O error or serialization error occurs
    • writeTo

      static int writeTo(OutputStream out, Object object, JSONWriter.Context context)
      Serializes the specified object to the json byte array and write it to OutputStream
      Parameters:
      out - the specified output stream to be written
      object - the specified object will be serialized
      context - the specified custom context
      Returns:
      the length of byte stream
      Throws:
      JSONException - If an I/O error or serialization error occurs
      Since:
      2.0.51
    • writeTo

      static int writeTo(OutputStream out, Object object, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array and write it to OutputStream
      Parameters:
      out - the specified output stream to be written
      object - the specified object will be serialized
      features - the specified features is applied to serialization
      Returns:
      the length of byte stream
      Throws:
      JSONException - If an I/O error or serialization error occurs
    • writeTo

      static int writeTo(OutputStream out, Object object, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array and write it to OutputStream
      Parameters:
      out - the specified output stream to be written
      object - the specified object will be serialized
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      the length of byte stream
      Throws:
      JSONException - If an I/O error or serialization error occurs
    • writeTo

      static int writeTo(OutputStream out, Object object, String format, Filter[] filters, JSONWriter.Feature... features)
      Serializes the specified object to the json byte array and write it to OutputStream
      Parameters:
      out - the specified output stream to be written
      object - the specified object will be serialized
      format - the specified date format
      filters - the specified filters is applied to serialization
      features - the specified features is applied to serialization
      Returns:
      the length of byte stream
      Throws:
      JSONException - If an I/O error or serialization error occurs
    • isValid

      static boolean isValid(String text)
      Verify that the json string is legal json text
      Parameters:
      text - the specified string will be validated
      Returns:
      true or false
    • isValid

      static boolean isValid(String text, JSONReader.Feature... features)
      Verify that the json string is legal json text
      Parameters:
      text - the specified string will be validated
      features - the specified features is applied to parsing
      Returns:
      true or false
    • isValid

      static boolean isValid(char[] chars)
      Verify that the json char array is legal json text
      Parameters:
      chars - the specified array will be validated
      Returns:
      true or false
    • isValidObject

      static boolean isValidObject(String text)
      Verify that the json string is a legal JsonObject
      Parameters:
      text - the specified string will be validated
      Returns:
      true or false
    • isValidObject

      static boolean isValidObject(byte[] bytes)
      Verify that the json byte array is a legal JsonObject
      Parameters:
      bytes - the specified array will be validated
      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 that the json byte array is legal json text
      Parameters:
      bytes - the specified array will be validated
      Returns:
      true or false
    • isValid

      static boolean isValid(byte[] bytes, Charset charset)
      Verify that the json byte array is legal json text
      Parameters:
      bytes - the specified array will be validated
      charset - the specified charset of the bytes
      Returns:
      true or false
    • isValidArray

      static boolean isValidArray(byte[] bytes)
      Verify that the json byte array is a legal JsonArray
      Parameters:
      bytes - the specified array will be validated
      Returns:
      true or false
    • isValid

      static boolean isValid(byte[] bytes, int offset, int length, Charset charset)
      Verify that the json byte array is legal json text
      Parameters:
      bytes - the specified array will be validated
      offset - the starting index of array
      length - the specified length of array
      charset - the specified charset of the bytes
      Returns:
      true or false
    • toJSON

      static Object toJSON(Object object)
      Converts the specified object to a JSONArray or JSONObject. Returns null if received object is null
      Parameters:
      object - the specified object to be converted
      Returns:
      JSONArray or JSONObject or null
    • toJSON

      static Object toJSON(Object object, JSONWriter.Feature... features)
      Converts the specified object to a JSONArray or JSONObject. Returns null if received object is null
      Parameters:
      object - the specified object to be converted
      features - the specified features is applied to serialization
      Returns:
      JSONArray or JSONObject or null
    • to

      static <T> T to(Class<T> clazz, Object object)
      Converts the specified object to an object of the specified goal type
      Parameters:
      clazz - the specified goal class
      object - the specified 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)
      Converts the specified object to an object of the specified goal type
      Parameters:
      clazz - the specified goal class
      object - the specified object to be converted
    • 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:
    • register

      static ObjectReader<?> register(Type type, ObjectReader<?> objectReader, boolean fieldBased)
      Register an ObjectReader for Type in default ObjectReaderProvider
      Since:
      2.0.38
      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:
    • registerIfAbsent

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

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

      static void registerSeeAlsoSubType(Class subTypeClass)
    • registerSeeAlsoSubType

      static void registerSeeAlsoSubType(Class subTypeClass, String subTypeClassName)
    • 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:
    • register

      static ObjectWriter<?> register(Type type, ObjectWriter<?> objectWriter, boolean fieldBased)
      Register an ObjectWriter for Type in default ObjectWriterProvider
      Since:
      2.0.38
      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:
    • registerIfAbsent

      static ObjectWriter<?> registerIfAbsent(Type type, ObjectWriter<?> objectWriter, boolean fieldBased)
      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
    • configReaderDateFormat

      static void configReaderDateFormat(String dateFormat)
      config default reader dateFormat
      Parameters:
      dateFormat -
      Since:
      2.0.30
    • configWriterDateFormat

      static void configWriterDateFormat(String dateFormat)
      config default reader dateFormat
      Parameters:
      dateFormat -
    • configReaderZoneId

      static void configReaderZoneId(ZoneId zoneId)
      config default reader zoneId
      Parameters:
      zoneId -
      Since:
      2.0.36
    • configWriterZoneId

      static void configWriterZoneId(ZoneId zoneId)
      config default writer zoneId
      Parameters:
      zoneId -
      Since:
      2.0.36
    • 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)
      Builds a new JSON using the properties of the specified object
      Parameters:
      object - the specified object will be copied
      features - the specified features is applied to serialization
      Since:
      2.0.12
    • copyTo

      static <T> T copyTo(Object object, Class<T> targetClass, JSONWriter.Feature... features)
      Builds a new instance of targetClass using the properties of the specified object
      Parameters:
      object - the specified object will be copied
      targetClass - the specified target class
      features - the specified features is applied to serialization
      Since:
      2.0.16