peekJson

abstract fun peekJson(): JsonReader

Returns a new {@code JsonReader} that can read data from this {@code JsonReader} withoutconsuming it. The returned reader becomes invalid once this one is next read or closed.

For example, we can use {@code peekJson()} to lookahead and read the same data multipletimes.

{@code * Buffer buffer = new Buffer(); * buffer.writeUtf8("[123, 456, 789]") * * JsonReader jsonReader = JsonReader.of(buffer); * jsonReader.beginArray(); * jsonReader.nextInt(); // Returns 123, reader contains 456, 789 and ]. * * JsonReader peek = reader.peekJson(); * peek.nextInt() // Returns 456. * peek.nextInt() // Returns 789. * peek.endArray() * * jsonReader.nextInt() // Returns 456, reader contains 789 and ]. * }