JsoniterScalaCodec

io.circe.JsoniterScalaCodec
See theJsoniterScalaCodec companion object
final class JsoniterScalaCodec(maxDepth: Int, initialSize: Int, doSerialize: Json => Boolean, numberParser: JsonReader => Json, numberSerializer: (JsonWriter, JsonNumber) => Unit) extends JsonValueCodec[Json]

A JSON value codec that parses and serialize to/from circe's JSON AST.

Value parameters

doSerialize

a predicate that determines whether a value should be serialized

initialSize

the initial size hint for object and array collections

maxDepth

the maximum depth for decoding

numberParser

a function that parses JSON numbers

numberSerializer

a function that serializes JSON numbers

Attributes

Returns

The JSON codec

Companion
object
Graph
Supertypes
trait JsonValueCodec[Json]
trait Serializable
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(maxDepth: Int, initialSize: Int, doSerialize: Json => Boolean, numberParser: JsonReader => Json)

An auxiliary constructor for backward binary compatibility.

An auxiliary constructor for backward binary compatibility.

Value parameters

doSerialize

a predicate that determines whether a value should be serialized

initialSize

the initial size hint for object and array collections

maxDepth

the maximum depth for decoding

numberParser

a function that parses JSON numbers

Attributes

Concrete methods

override def decodeValue(in: JsonReader, default: Json): Json

Attempts to decode a value of type A from the specified JsonReader, but may fail with JsonReaderException error if the JSON input does not encode a value of this type.

Attempts to decode a value of type A from the specified JsonReader, but may fail with JsonReaderException error if the JSON input does not encode a value of this type.

Value parameters

default

the placeholder value provided to initialize some possible local variables

in

an instance of JsonReader which provide an access to the JSON input to parse a JSON value to value of type A

Attributes

Definition Classes
JsonValueCodec
override def encodeValue(x: Json, out: JsonWriter): Unit

Encodes the specified value using provided JsonWriter, but may fail with JsonWriterException if it cannot be encoded properly according to RFC-8259 requirements.

Encodes the specified value using provided JsonWriter, but may fail with JsonWriterException if it cannot be encoded properly according to RFC-8259 requirements.

Value parameters

out

an instance of JsonWriter which provides access to JSON output to serialize the specified value as a JSON value

x

the value provided for serialization

Attributes

Definition Classes
JsonValueCodec

Concrete fields

override val nullValue: Json

Returns some placeholder value that will be used by the high level code that generates codec instances to initialize local variables for parsed field values which have a codec that was injected using implicit val.

Returns some placeholder value that will be used by the high level code that generates codec instances to initialize local variables for parsed field values which have a codec that was injected using implicit val.

See the jsoniter-scala-macros sub-project code and its tests for usages of .nullValue calls.

Attributes