fs2


License

License

GroupId

GroupId

io.circe
ArtifactId

ArtifactId

circe-fs2_2.11
Last Version

Last Version

0.12.0-M1
Release Date

Release Date

Type

Type

jar
Description

Description

fs2
fs2
Project URL

Project URL

https://github.com/circe/circe-fs2
Project Organization

Project Organization

io.circe
Source Code Management

Source Code Management

https://github.com/circe/circe-fs2

Download circe-fs2_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/io.circe/circe-fs2_2.11/ -->
<dependency>
    <groupId>io.circe</groupId>
    <artifactId>circe-fs2_2.11</artifactId>
    <version>0.12.0-M1</version>
</dependency>
// https://jarcasting.com/artifacts/io.circe/circe-fs2_2.11/
implementation 'io.circe:circe-fs2_2.11:0.12.0-M1'
// https://jarcasting.com/artifacts/io.circe/circe-fs2_2.11/
implementation ("io.circe:circe-fs2_2.11:0.12.0-M1")
'io.circe:circe-fs2_2.11:jar:0.12.0-M1'
<dependency org="io.circe" name="circe-fs2_2.11" rev="0.12.0-M1">
  <artifact name="circe-fs2_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.circe', module='circe-fs2_2.11', version='0.12.0-M1')
)
libraryDependencies += "io.circe" % "circe-fs2_2.11" % "0.12.0-M1"
[io.circe/circe-fs2_2.11 "0.12.0-M1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
co.fs2 : fs2-core_2.11 jar 1.1.0-M1
io.circe : circe-jawn_2.11 jar 0.12.0-M3
org.typelevel : jawn-parser_2.11 jar 0.14.2

test (4)

Group / Artifact Type Version
io.circe : circe-generic_2.11 jar 0.12.0-M3
io.circe : circe-testing_2.11 jar 0.12.0-M3
org.scalatest : scalatest_2.11 jar 3.1.0-SNAP13
org.scalatestplus : scalatestplus-scalacheck_2.11 jar 1.0.0-SNAP8

Project Modules

There are no modules declared in this project.

circe-fs2

Build status Coverage status Gitter Maven Central

This project provides support for using fs2 for streaming JSON parsing and decoding with circe, a Scala library for encoding and decoding JSON to Scala types.

Parsing

Circe-fs2 provides different pipes to parse your streams of JSONs depending on whether your stream is:

  • a \n-separated stream of JSON values or value stream:
{ "repo": "circe-fs2", "stars": 14 }
{ "repo": "circe-config", "stars": 5 }
  • or a JSON array:
[
  { "repo": "circe-fs2", "stars": 14 },
  { "repo": "circe-config", "stars": 5 }
]

The appropriate pipe for the job also depends on your input stream value type (i.e. String, Byte or Segment[Byte]).

The following table sums up every pipe available as a function of the input stream value type as well as the JSON structure:

String Byte Segment[Byte]
Value stream stringStreamParser byteStreamParser byteStreamParserS
Array stringArrayParser byteArrayParser byteArrayParserS

As an example, let's say we have a stream of strings representing a JSON array, we'll pick the stringArrayParser pipe which converts a stream of String to a stream of Json, Circe's representation of JSONs:

import io.circe.fs2._
val stringStream: Stream[IO, String] = ...
val parsedStream: Stream[IO, Json] = stringStream.through(stringArrayParser)

Decoding

Circe-fs2 also comes with a decoder pipe which, given a Decoder[A], produces a Stream[F[_], Json] => Stream[F[_], A] pipe.

For example, using Circe's fully automatic derivation:

import io.circe.generic.auto._
case class Foo(a: Int, b: String)
val parsedStream: Stream[IO, Json] = ...
val decodedStream: Stream[IO, Foo] = parsedStream.through(decoder[IO, Foo])

Contributors and participation

All circe projects support the Typelevel code of conduct and we want all of their channels (Gitter, GitHub, etc.) to be welcoming environments for everyone.

Please see the circe contributors' guide for details on how to submit a pull request.

License

circe-fs2 is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

io.circe

circe

Versions

Version
0.12.0-M1
0.11.0
0.10.0
0.10.0-M1
0.9.0
0.9.0-M4
0.9.0-M3
0.9.0-M2
0.9.0-M1
0.8.0