Class JSON

java.lang.Object
org.apache.ofbiz.base.lang.JSON

@ThreadSafe public final class JSON extends Object
A JSON object.
  • Method Details

    • from

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

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

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

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

      public String toString()
      Overrides:
      toString in class Object