Class JSONList


  • public class JSONList
    extends JSONObject
    This class is used to define a JSON object as List.
    • Constructor Detail

      • JSONList

        public JSONList​(String json)
        Constructs a JSONList from a JSON string
        Parameters:
        json - the JSON string
      • JSONList

        public JSONList​(List<?> values)
        Initializes the JSONList with existed values
        Parameters:
        values - the JSON list values
    • Method Detail

      • get

        public <T> T get​(int index)
        Description copied from class: JSONObject
        Get the value at the given index

        Note: this is for JSONList only.

        Overrides:
        get in class JSONObject
        Type Parameters:
        T - the type of the value
        Parameters:
        index - the index of the value
        Returns:
        the value at the given index
      • getJSON

        public JSON getJSON​(int index)
        Description copied from class: JSONObject
        Get as JSON at the given index

        Note: this is for JSONList only.

        Overrides:
        getJSON in class JSONObject
        Parameters:
        index - the index of the JSON
        Returns:
        the JSON at the given index
      • getList

        public JSONList getList​(int index)
        Description copied from class: JSONObject
        Get the list at the given index

        Note: this is for JSONList only.

        Overrides:
        getList in class JSONObject
        Parameters:
        index - the index of the list
        Returns:
        the list at the given index
      • getValues

        public List<?> getValues()
      • toJson

        public String toJson()
        Description copied from class: JSONObject
        Translate this JSON instance into json String
        Specified by:
        toJson in class JSONObject
        Returns:
        json String translated from this JSON instance