JsonScope

Lexical scoping elements within a JSON reader or writer.

class JsonScope

Functions

getPath
Link copied to clipboard

Renders the path in a JSON document to a string. The {@code pathNames} and {@code pathIndices} parameters corresponds directly to stack: At indices where the stack contains an object (EMPTY_OBJECT, DANGLING_NAME or NONEMPTY_OBJECT), pathNames contains the name at this scope. Where it contains an array (EMPTY_ARRAY, NONEMPTY_ARRAY) pathIndices contains the current index in that array. Otherwise the value is undefined, and we take advantage of that by incrementing pathIndices when doing so isn't useful.

open fun getPath(stackSize: Int, stack: Array<Int>, pathNames: Array<String>, pathIndices: Array<Int>): String

Properties

CLOSED
Link copied to clipboard

A document that's been closed and cannot be accessed.

val CLOSED: Int
DANGLING_NAME
Link copied to clipboard

An object whose most recent element is a key. The next element must be a value.

val DANGLING_NAME: Int
EMPTY_ARRAY
Link copied to clipboard

An array with no elements requires no separators or newlines before it is closed.

val EMPTY_ARRAY: Int
EMPTY_DOCUMENT
Link copied to clipboard

No object or array has been started.

val EMPTY_DOCUMENT: Int
EMPTY_OBJECT
Link copied to clipboard

An object with no name/value pairs requires no separators or newlines before it is closed.

val EMPTY_OBJECT: Int
NONEMPTY_ARRAY
Link copied to clipboard

A array with at least one value requires a comma and newline before the next element.

val NONEMPTY_ARRAY: Int
NONEMPTY_DOCUMENT
Link copied to clipboard

A document with at an array or object.

val NONEMPTY_DOCUMENT: Int
NONEMPTY_OBJECT
Link copied to clipboard

An object with at least one name/value pair requires a separator before the next element.

val NONEMPTY_OBJECT: Int
STREAMING_VALUE
Link copied to clipboard

Sits above the actual state to indicate that a value is currently being streamed in.

val STREAMING_VALUE: Int