fs2.data.json

Handles stream parsing and traversing of json documents.

Type members

Classlikes

sealed trait IndexPredicate extends Int => Boolean
Companion:
object
Companion:
class
sealed trait JsonContext

A JSON trace context, positioning the current location in the JSON value starting from the root.

A JSON trace context, positioning the current location in the JSON value starting from the root.

Companion:
object
Companion:
class
case class JsonException(msg: String, context: Option[JsonContext], inner: Throwable) extends Exception
class JsonMissingFieldException(msg: String, val missing: Set[String]) extends Exception
case class JsonSelectorException(msg: String, idx: Int) extends Exception
final implicit class JsonSelectorStringOps(val s: String) extends AnyVal
sealed trait NamePredicate extends String => Boolean
Companion:
object
Companion:
class
sealed trait Selector

Used to select tokens in a token stream.

Used to select tokens in a token stream.

Companion:
object
object Selector
Companion:
class
class SelectorParser[F[_]](val input: String)(implicit F: MonadError[F, Throwable])

Parses a filter string. Syntax is as follows:

Parses a filter string. Syntax is as follows:

Selector ::= `.`
          | Sel Sel*

Sel ::= `.` Name `!`? `?`?
     | `.` `[` String (`,` String)* `]` `!`? `?`?
     | `.` `[` Integer (`,` Integer)* `]` `?`?
     | `.` `[` Integer `:` Integer `]` `?`?
     | `.` `[` `]` `?`?

Name ::= [a-zA-Z_][a-zA-Z0-9_]*

String ::= <a json string>

Integer ::= 0
         | [1-9][0-9]*
Companion:
object
Companion:
class
sealed abstract class Token(val kind: String)
Companion:
object
object Token
Companion:
class
object collector

Json Token stream collectors.

Json Token stream collectors.

object render

Json Token stream pipes to render Json values.

Json Token stream pipes to render Json values.

object wrap

A collection of pipes to wrap streams inside objects.

A collection of pipes to wrap streams inside objects.

Value members

Concrete methods

def filter[F[_]](selector: Selector, wrap: Boolean)(implicit F: RaiseThrowable[F]): (F, Token) => Token

Filters the tokens according to the given selector sequence. if wrap is set to true then values selected by array selector are wrapped into an array, and values selected by object selector are wrapped into an object with original key maintained.

Filters the tokens according to the given selector sequence. if wrap is set to true then values selected by array selector are wrapped into an array, and values selected by object selector are wrapped into an object with original key maintained.

def tokens[F[_], T](implicit F: RaiseThrowable[F], T: CharLikeChunks[F, T]): (F, T) => Token

Transforms a stream of characters into a stream of Json tokens. Emitted tokens are guaranteed to be valid up to that point. If the streams ends without failure, the sequence of tokens is sensured to represent a (potentially empty) sequence of valid Json documents.

Transforms a stream of characters into a stream of Json tokens. Emitted tokens are guaranteed to be valid up to that point. If the streams ends without failure, the sequence of tokens is sensured to represent a (potentially empty) sequence of valid Json documents.

Deprecated methods

@deprecated(message = "Use `fs2.data.json.ast.tokenize` instead", since = "1.3.0")
def tokenize[F[_], Json](implicit tokenizer: Tokenizer[Json]): (F, Json) => Token

Transforms a stream of Json values into a stream of Json tokens.

Transforms a stream of Json values into a stream of Json tokens.

This operation is the opposite of values.

Deprecated
[Since version 1.3.0] Use `fs2.data.json.ast.tokenize` instead
@deprecated(message = "Use `fs2.data.json.ast.transform` instead", since = "1.3.0")
def transform[F[_], Json](selector: Selector, f: Json => Json)(implicit F: RaiseThrowable[F], builder: Builder[Json], tokenizer: Tokenizer[Json]): (F, Token) => Token

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. The rest of the stream is left unchanged.

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. The rest of the stream is left unchanged.

This operator locally creates Json AST values using the Builder, and returns tokens as emitted by the Tokenizer on the resulting value.

Deprecated
[Since version 1.3.0] Use `fs2.data.json.ast.transform` instead
@deprecated(message = "Use `fs2.data.json.ast.transformF` instead", since = "1.3.0")
def transformF[F[_], Json](selector: Selector, f: Json => F[Json])(implicit F: RaiseThrowable[F], builder: Builder[Json], tokenizer: Tokenizer[Json]): (F, Token) => Token

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. The rest of the stream is left unchanged. The operation can fail, in case the returned F is failed at one step.

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. The rest of the stream is left unchanged. The operation can fail, in case the returned F is failed at one step.

This operator locally creates Json AST values using the Builder, and returns tokens as emitted by the Tokenizer on the resulting value.

Deprecated
[Since version 1.3.0] Use `fs2.data.json.ast.transformF` instead
@deprecated(message = "Use `fs2.data.json.ast.transformOpt` instead", since = "1.3.0")
def transformOpt[F[_], Json](selector: Selector, f: Json => Option[Json])(implicit F: RaiseThrowable[F], builder: Builder[Json], tokenizer: Tokenizer[Json]): (F, Token) => Token

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. If the function returns None, then the entire value is dropped (and the object key it is located at, if any). The rest of the stream is left unchanged.

Transforms a stream of token into another one. The transformation function f is called on every selected value from upstream, and the resulting value replaces it. If the function returns None, then the entire value is dropped (and the object key it is located at, if any). The rest of the stream is left unchanged.

This operator locally creates Json AST values using the Builder, and returns tokens as emitted by the Tokenizer on the resulting value.

Deprecated
[Since version 1.3.0] Use `fs2.data.json.ast.transformOpt` instead
@deprecated(message = "Use `fs2.data.json.ast.values` instead", since = "1.3.0")
def values[F[_], Json](implicit F: RaiseThrowable[F], builder: Builder[Json]): (F, Token) => Json

Transforms a stream of Json tokens into a stream of json values.

Transforms a stream of Json tokens into a stream of json values.

Deprecated
[Since version 1.3.0] Use `fs2.data.json.ast.values` instead

Implicits

Implicits

final implicit def JsonSelectorStringOps(s: String): JsonSelectorStringOps