net.markenwerk:utils-json-handler-text

Text handler for JSON processing libraries for Java

License

License

Categories

Categories

Net JSON Data
GroupId

GroupId

net.markenwerk
ArtifactId

ArtifactId

utils-json-handler-text
Last Version

Last Version

2.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

net.markenwerk:utils-json-handler-text
Text handler for JSON processing libraries for Java
Project URL

Project URL

https://github.com/markenwerk/java-utils-json-handler-text
Project Organization

Project Organization

Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH
Source Code Management

Source Code Management

https://github.com/markenwerk/java-utils-json-handler-text

Download utils-json-handler-text

How to add to project

<!-- https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-text/ -->
<dependency>
    <groupId>net.markenwerk</groupId>
    <artifactId>utils-json-handler-text</artifactId>
    <version>2.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-text/
implementation 'net.markenwerk:utils-json-handler-text:2.0.2'
// https://jarcasting.com/artifacts/net.markenwerk/utils-json-handler-text/
implementation ("net.markenwerk:utils-json-handler-text:2.0.2")
'net.markenwerk:utils-json-handler-text:jar:2.0.2'
<dependency org="net.markenwerk" name="utils-json-handler-text" rev="2.0.2">
  <artifact name="utils-json-handler-text" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.markenwerk', module='utils-json-handler-text', version='2.0.2')
)
libraryDependencies += "net.markenwerk" % "utils-json-handler-text" % "2.0.2"
[net.markenwerk/utils-json-handler-text "2.0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
net.markenwerk : utils-json-handler jar 2.0.1
net.markenwerk : utils-text-indentation jar 1.1.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Text handler for JSON libraries

Build Status Coverage Status Dependency Status Maven Central Issues MIT License

Overview

This library provides text related JSON handlers for other JSON processing libraries.

Consult the documentation and the usage description for further information:

Maven

This library is hosted in the Maven Central Repository. You can use it with the following coordinates:

<dependency>
	<groupId>net.markenwerk</groupId>
	<artifactId>utils-json-handler-text</artifactId>
	<version>2.0.2</version>
</dependency>

Usage

Java text handler

An AppendingJavaTextJsonHandler is a JsonHandler that appends a text, that represents the described JSON document by mimicing the toString() behavior of Java collection classes, to an Appendable.

// a JsonDocument
JsonDocument document = ...

// writes a pretty printed json document into test.json  
Writer writer = new FileWriter(new File("test.json"));
document.handle(new AppendingJavaTextJsonHandler(writer));
writer.close();

The appended String for the example.json has the following content:

{null=null, boolean=true, long=-42, double=-23.42, array=[foo, bar]}

A JavaTextJsonHandler is a JsonHandler that creates a String, containing a text that represents the described JSON document by mimicing the toString() behavior of Java collection classes.

// a JsonDocument
JsonDocument document = ...

// returns a pretty printed json document  
String json = document.handle(new JavaTextJsonHandler(writer));

The returned String for the example.json has the following content:

{null=null, boolean=true, long=-42, double=-23.42, array=[foo, bar]}

JSON text handler

An AppendingJsonTextJsonHandler is a JsonHandler that appends a JSON text, that represents the described JSON document, to an Appendable.

// a JsonDocument
JsonDocument document = ...

// writes a pretty printed json document into test.json  
Writer writer = new FileWriter(new File("test.json"));
document.handle(new AppendingJsonTextJsonHandler(writer));
writer.close();

The appended String for the example.json has the following content:

{
    "null" : null,
    "boolean" : true,
    "long" : -42,
    "double" : -23.42,
    "array" : [
        "foo",
        "bar"
    ]
}

A JsonTextJsonHandler is a JsonHandler that creates a String, containing a JSON text that represents the described JSON document.

// a JsonDocument
JsonDocument document = ...

// returns a pretty printed json document  
String json = document.handle(new JsonTextJsonHandler(writer));

The returned String for the example.json has the following content:

{
    "null" : null,
    "boolean" : true,
    "long" : -42,
    "double" : -23.42,
    "array" : [
        "foo",
        "bar"
    ]
}
net.markenwerk

Markenwerk

Versions

Version
2.0.2
2.0.1
2.0.0
1.0.0