Skip to content

abilng/ndjson

ndjson

Build Status Maven Central

Java library for creating and parsing ND-JSON

Uses Jackson JSON parser

Usage

Deserialization

    NdJsonObjectMapper ndJsonObjectMapper = new NdJsonObjectMapper();
    InputStream is = ....;
    Stream<Car> readValue = ndJsonObjectMapper.readValue(is, Car.class);

Serialization

    NdJsonObjectMapper ndJsonObjectMapper = new NdJsonObjectMapper();
    OutputStream out = ... ;
    Stream <Car> carStream = ...;
    ndJsonObjectMapper.writeValue(out, carStream);

How to add NDJSON to your project

Maven:

<dependency>
  <groupId>in.abilng</groupId>
  <artifactId>ndjson</artifactId>
  <version>1.0.1</version>
</dependency>

SBT:

libraryDependencies += "in.abilng" % "ndjson"