JsonSplitterApplyOps

final class JsonSplitterApplyOps(splitter: Splitter) extends AnyVal

Adds Splitter.json, for constructing json context matcher-based JsonSplitters

Adds Splitter.json, for constructing json context matcher-based JsonSplitters

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def json[C](matcher: ContextMatcher[JsonStackElem, C])(pos: CallerPos): JsonSplitter[C]

Create a Splitter for JsonEvents using the given matcher to determine where sub-streams start and end. For example, Splitter.json("foo"), when applied to the json:

Create a Splitter for JsonEvents using the given matcher to determine where sub-streams start and end. For example, Splitter.json("foo"), when applied to the json:

{
 "foo": [1, 2],
 "bar": true
}

would identify the value of the object's "foo" field as a sub-stream of JsonEvents, containing the events ArrayStart, IndexStart(0), JLong(1), IndexEnd, IndexStart(1), JLong(2), IndexEnd, ArrayEnd.

Any context matched by the matcher will be passed through the joiner functions if you call as, map, or flatMap on the resulting splitter, and thus the matched context can be used to decide how you parse each sub-stream.

Type Params
C

The type of the "context" matched by the matcher

Value Params
matcher

A ContextMatcher used to identify where each sub-stream begins and ends, and extracts some context value to identify each sub-stream.

pos

Used to construct a SpacFrameElement if a parser constructed from this splitter fails

Returns

A new JsonSplitter that will split a stream into sub-streams identified by the matcher