Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

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.10+.

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.1"

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

About

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

Resources

License

Packages

No packages published