程序包 com.sh.json

接口 JSON

所有超级接口:
Serializable
所有已知实现类:
JSONArray, JSONNull, JSONObject

public interface JSON extends Serializable
Marker interface, identifies a valid JSON value.
A JSON value may be a JSONObject, a JSONArray or a JSONNull.
  • 方法详细资料

    • isArray

      boolean isArray()
      Returns true if this object is a JSONArray, false otherwise.
    • isEmpty

      boolean isEmpty()
      Returns true if this object has no elements or keys.
      抛出:
      JSONException - if called on a 'null' object
    • size

      int size()
      Returns the number of properties in an object or the size of the array.
      返回:
      the size of an json object or array
      抛出:
      JSONException - if called on a 'null' object
    • toString

      String toString(int indentFactor)
      Make a prettyprinted JSON text.

      Warning: This method assumes that the data structure is acyclical.

      参数:
      indentFactor - The number of spaces to add to each level of indentation.
      返回:
      a printable, displayable, portable, transmittable representation of the object, beginning with { (left brace) and ending with } (right brace).
      抛出:
      JSONException - If the object contains an invalid number.
    • toString

      String toString(int indentFactor, int indent)
      Make a prettyprinted JSON text.

      Warning: This method assumes that the data structure is acyclical.

      参数:
      indentFactor - The number of spaces to add to each level of indentation.
      indent - The indentation of the top level.
      返回:
      a printable, displayable, transmittable representation of the object, beginning with { (left brace) and ending with } (right brace).
      抛出:
      JSONException - If the object contains an invalid number.
    • write

      Writer write(Writer writer)
      Write the contents as JSON text to a writer. For compactness, no whitespace is added.

      Warning: This method assumes that the data structure is acyclical.

      返回:
      The writer.
      抛出:
      JSONException
    • parseObject

      static JSONObject parseObject(String str)
    • parseArray

      static JSONArray parseArray(String str)
    • toJSONBytes

      static byte[] toJSONBytes(JSONObject object)
    • toJSONBytes

      static byte[] toJSONBytes(JSONArray object)