Attributes
- Companion
- class
- Source
- JsoniterPrism.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsoniterPrism.type
Members list
Grouped members
Optics
Root-level Prism from a JSON byte buffer to a native type A — a Prism[Array[Byte], A]: to decodes the WHOLE document via the codec (Miss when it doesn't decode as A), from / JsoniterPrism.reverseGet encode via writeToArray. At the root the full-cover Prism laws hold (up to canonical re-encoding). Drill from here with .field: JsoniterPrism[Person].field(_.age).
Root-level Prism from a JSON byte buffer to a native type A — a Prism[Array[Byte], A]: to decodes the WHOLE document via the codec (Miss when it doesn't decode as A), from / JsoniterPrism.reverseGet encode via writeToArray. At the root the full-cover Prism laws hold (up to canonical re-encoding). Drill from here with .field: JsoniterPrism[Person].field(_.age).
Attributes
- Source
- JsoniterPrism.scala
Constructors
Build a read-write Prism over a JSON byte buffer at the given JSONPath — the ONLY string-path constructor, and it keeps the failure in the type. An unparseable path, or one carrying a [*] wildcard (a JsoniterTraversal shape), comes back as Left(message): a path is DATA (a config value, a CLI argument, a registry lookup), so there is no throwing twin to reach for. Path syntax: $, dotted field names ($.foo.bar), array indices ($[0]). See PathParser for the full grammar; apply is the path-free root constructor.
Build a read-write Prism over a JSON byte buffer at the given JSONPath — the ONLY string-path constructor, and it keeps the failure in the type. An unparseable path, or one carrying a [*] wildcard (a JsoniterTraversal shape), comes back as Left(message): a path is DATA (a config value, a CLI argument, a registry lookup), so there is no throwing twin to reach for. Path syntax: $, dotted field names ($.foo.bar), array indices ($[0]). See PathParser for the full grammar; apply is the path-free root constructor.
Attributes
- Example
-
import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker given codec: JsonValueCodec[Long] = JsonCodecMaker.make val idP: Either[String, JsoniterPrism[Long]] = JsoniterPrism.fromPath[Long]("$.payload.user.id") val bytes: Array[Byte] = ... idP.map(_.foldMap(identity)(bytes)) // Either[String, Long], no AST allocation - Source
- JsoniterPrism.scala
Extensions
Extensions
.field(_.x) — drill via selector lambda, compile-time checked against A's case fields.
.field(_.x) — drill via selector lambda, compile-time checked against A's case fields.
Attributes
- Source
- JsoniterPrism.scala
.at(i) — drill into the i-th array element.
.each — split into a JsoniterTraversal over the iterated array.
.each — split into a JsoniterTraversal over the iterated array.
Attributes
- Source
- JsoniterPrism.scala