MapJsonReader

class MapJsonReader(root: Map<String, Any?>) : JsonReader

A JsonReader that reads data from a regular Map<String, Any?>

Map values should be any of:

  • String

  • Int

  • Double

  • Long

  • JsonNumber

  • null

  • Map<String, Any?> where values are any of these values recursively

  • List<Any?> where values are any of these values recursively

Anything else is undefined

Parameters

root

the root Map to read from

Because it's mostly used internally the checks/verifications are very slim. To read from a okio.BufferedSource, see also BufferedSourceJsonReader

Constructors

MapJsonReader
Link copied to clipboard
common
fun MapJsonReader(root: Map<String, Any?>)
the root Map to read fromBecause it's mostly used internally the checks/verifications are very slim.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

beginArray
Link copied to clipboard
common
open override fun beginArray(): MapJsonReader
Consumes the next token from the JSON stream and asserts that it is the beginning of a new array.
beginObject
Link copied to clipboard
common
open override fun beginObject(): MapJsonReader
Consumes the next token from the JSON stream and asserts that it is the beginning of a new object.
close
Link copied to clipboard
common
open override fun close()
endArray
Link copied to clipboard
common
open override fun endArray(): MapJsonReader
Consumes the next token from the JSON stream and asserts that it is the end of the current array.
endObject
Link copied to clipboard
common
open override fun endObject(): MapJsonReader
Consumes the next token from the JSON stream and asserts that it is the end of the current object.
hasNext
Link copied to clipboard
common
open override fun hasNext(): Boolean
Returns true if the current array or object has another element.
nextBoolean
Link copied to clipboard
common
open override fun nextBoolean(): Boolean
Returns the Token.
nextDouble
Link copied to clipboard
common
open override fun nextDouble(): Double
Returns the Token.
nextInt
Link copied to clipboard
common
open override fun nextInt(): Int
Returns the Token.
nextLong
Link copied to clipboard
common
open override fun nextLong(): Long
Returns the Token.
nextName
Link copied to clipboard
common
open override fun nextName(): String
Returns the next token Token.
nextNull
Link copied to clipboard
common
open override fun nextNull(): Nothing?
Consumes the next token from the JSON stream and asserts that it is a literal null.
nextNumber
Link copied to clipboard
common
open override fun nextNumber(): JsonNumber
Returns the Token.
nextString
Link copied to clipboard
common
open override fun nextString(): String?
Returns the Token.
peek
Link copied to clipboard
common
open override fun peek(): JsonReader.Token
Returns the type of the next token without consuming it.
rewind
Link copied to clipboard
common
open override fun rewind()
Rewinds to the beginning of the current object.
selectName
Link copied to clipboard
common
open override fun selectName(names: List<String>): Int
An optimized way to retrieve the nextName when the candidates and their order is known.
skipValue
Link copied to clipboard
common
open override fun skipValue()
Skips the next value recursively.

Properties

root
Link copied to clipboard
common
val root: Map<String, Any?>
the root Map to read fromBecause it's mostly used internally the checks/verifications are very slim.