Skip to content
Incremental (non-blocking) parsing for Scala JSON ASTs, based on jackson-core.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project
src
.gitignore
LICENSE
README.adoc
build.sbt

README.adoc

jackshaft

Incremental (non-blocking) parsing for Scala JSON ASTs, based on jackson-core.

Supported ASTs: spray-json.

Supported Scala versions: 2.11, 2.12, 2.13.

Supported jackson-core versions: 2.9+.

Caution
Alpha-quality software.

Provides

For each supported AST:

  • akka-http entity marshaller and unmarshaller for single JSON values and akka-stream streams

  • Regular String and InputStream/OutputStream parser and printer for completeness

Usage

Artifact
"net.zygfryd" %% "jackshaft" % "0.2.0"

Support for akka-http

Instead of the usual:

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._

use:

import zygf.jackshaft.spray.AkkaSprayJsonSupport._

Marshalling and unmarshalling of single values should work the same. Streaming multiple values however no longer uses the *EntityStreamingSupport classes, as these are designed to configure a framing protocol, which isn’t needed with native support for multiple values.

To unmarshal an entity as a stream of JSON values simply use:

entity(as[Source[JsValue, NotUsed]]) { ... }

By default jackshaft assumes a whitespace-separated format for multiple values, if you’d like to stream the contents of an array instead, define:

import zygf.jackshaft.conf._

implicit val config = JackshaftConfig.default.copy(streamingMode = StreamingMode.Array)

Performance

Parsing performance is on average slightly above the default spray-json parser, and should use less memory for large JSON documents.

Printing performance is 20-50% lower than competing libraries, due to its non-blocking nature.

TODO

  • optimize

  • add more ASTs

  • add more streaming IO frameworks

You can’t perform that action at this time.