Class JSON


  • @ThreadSafe
    public final class JSON
    extends java.lang.Object
    A JSON object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      static JSON from​(java.io.InputStream inStream)
      Creates a JSON instance from an InputStream.
      static JSON from​(java.io.Reader reader)
      Creates a JSON instance from a Reader.
      static JSON from​(java.lang.Object object)
      Creates a JSON instance from an unknown data type.
      static JSON from​(java.lang.String jsonString)
      Creates a JSON instance from a String.
      int hashCode()  
      <T> T toObject​(java.lang.Class<T> targetClass)
      Converts this JSON object to the specified type.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • from

        public static JSON from​(java.io.InputStream inStream)
                         throws java.io.IOException
        Creates a JSON instance from an InputStream. The method assumes the character set is UTF-8.
        Parameters:
        inStream -
        Returns:
        a JSON instance
        Throws:
        java.io.IOException
      • from

        public static JSON from​(java.lang.Object object)
                         throws java.io.IOException
        Creates a JSON instance from an unknown data type.
        Parameters:
        object -
        Returns:
        a JSON instance
        Throws:
        java.io.IOException
      • from

        public static JSON from​(java.io.Reader reader)
                         throws java.io.IOException
        Creates a JSON instance from a Reader.
        Parameters:
        reader -
        Returns:
        a JSON instance
        Throws:
        java.io.IOException
      • from

        public static JSON from​(java.lang.String jsonString)
        Creates a JSON instance from a String.
        Parameters:
        jsonString -
        Returns:
        a JSON instance
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toObject

        public <T> T toObject​(java.lang.Class<T> targetClass)
                       throws java.io.IOException
        Converts this JSON object to the specified type.
        Parameters:
        targetClass -
        Returns:
        an object of the specified type
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object