Class JsonUtil


  • public class JsonUtil
    extends java.lang.Object
    Utility class for working with JSON formatted values.
    Since:
    2.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Boolean toBoolean​(java.lang.String text)
      Parses a JSON formatted boolean from text.
      static java.lang.Number toNumber​(java.lang.String text)
      Parses a JSON formatted number from text.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toBoolean

        public static java.lang.Boolean toBoolean​(java.lang.String text)
                                           throws java.lang.IllegalArgumentException
        Parses a JSON formatted boolean from text.
        Parameters:
        text - the text to parse
        Returns:
        the parsed Boolean
        Throws:
        java.lang.IllegalArgumentException - if the text is not a valid boolean
      • toNumber

        public static java.lang.Number toNumber​(java.lang.String text)
                                         throws java.lang.NumberFormatException
        Parses a JSON formatted number from text.
        Parameters:
        text - the text to parse
        Returns:
        the parsed Number
        Throws:
        java.lang.NumberFormatException - if the text is not a valid number