Class JsonParseException

All Implemented Interfaces:
Serializable

public final class JsonParseException extends RuntimeException
Signals that an error has been detected while parsing the JSON text. This exception is thrown if the value supplied to either Json.parse(String) or Json.parse(char[]) is not valid JSON syntax, or contains a JSON object with duplicate names.
Since:
28
See Also:
  • Constructor Details

    • JsonParseException

      public JsonParseException(String message, int line, int pos)
      Constructs a JsonParseException with the specified detail message.
      Parameters:
      message - the detail message
      line - the zero-based line number of the error, counted by '\n' (linefeed, U+000A) characters. Non-negative.
      pos - the zero-based position of the error within the line, counted in UTF-16 code units. Non-negative.
      Throws:
      IllegalArgumentException - if line or pos are negative
  • Method Details

    • getErrorLine

      public int getErrorLine()
      Returns the zero-based line number of the error, counted by '\n' (linefeed, U+000A) characters.
      Returns:
      the zero-based line number of the error, counted by '\n' (linefeed, U+000A) characters
    • getErrorPosition

      public int getErrorPosition()
      Returns the zero-based position of the error within the line, counted in UTF-16 code units.
      Returns:
      the zero-based position of the error within the line, counted in UTF-16 code units