Package: groovy.json

## [Java] Class JsonLexer

- groovy.json.JsonLexer

- All Implemented Interfaces and Traits:
    Iterator

      public class JsonLexer
      extends Object
      implements Iterator

  The lexer reads JSON tokens in a streaming fashion from the underlying reader.

  Since:
    1.8.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `JsonLexer(Reader reader)` Instantiates a lexer with a reader from which to read JSON tokens.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public LineColumnReader` | `getReader()` Underlying reader from which to read the JSON tokens.
    `` | `public boolean` | `hasNext()` Iterator method to know if another token follows, or if we've reached the end of the stream.
    `` | `public JsonToken` | `next()` Iterator method to get the next token of the stream.
    `` | `public JsonToken` | `nextToken()` Returns: the next token from the stream
    `` | `public void` | `remove()` Method not implemented.
    `` | `public int` | `skipWhitespace()` Skips all the whitespace characters and moves the cursor to the next non-space character.
    `` | `public static String` | `unescape(String input)` Replace unicode escape and other control characters with real characters

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public JsonLexer(Reader reader)

      Instantiates a lexer with a reader from which to read JSON tokens. Under the hood, the reader is wrapped in a `LineColumnReader`, for line and column information, unless it's already an instance of that class.

      Parameters:
        `reader` - underlying reader

  - ### Method Detail

    - #### public LineColumnReader getReader()

      Underlying reader from which to read the JSON tokens. This reader is an instance of `LineColumnReader`, to keep track of line and column positions.

    - #### @Override
      public boolean hasNext()

      Iterator method to know if another token follows, or if we've reached the end of the stream.

      Returns:
        true if there are more tokens

    - #### @Override
      public JsonToken next()

      Iterator method to get the next token of the stream.

      Returns:
        the next token

    - #### public JsonToken nextToken()

      Returns:
        the next token from the stream

    - #### @Override
      public void remove()

      Method not implemented.

      throws:
        UnsupportedOperationException

    - #### public int skipWhitespace()

      Skips all the whitespace characters and moves the cursor to the next non-space character.

    - #### public static String unescape(String input)

      Replace unicode escape and other control characters with real characters

      Parameters:
        `input` - text
      Returns:
        input text without the escaping