A fast and small JSON parser and writer for Java
A fast and small JSON parser and writer for Java
I'm glad to see that minimal-json is still used, however, I can't maintain this project anymore. If anyone actively maintains a fork that follows the ideas of minimal-json, I'm happy to link to this repository here. Thank you. A fast and minimal JSON parser and writer for Java. It's not an object mapper, but a bare-bones library that aims at being
JsonArray user = Json.array().add("Bob").add(42); // -> ["Bob", 42]
You can also create JSON arrays conveniently from Java arrays such as `String[]`, `int[]`, `boolean[]`, etc.:
```java
String[] javaNames = {"Alice", "Bob"};
JsonArray jsonNames = Json.array(names);You can replace or remove array elements based on their index. The index must be valid.
jsonArray.set(1, 24);
jsonArray.remove(1);Likewise, members of JSON objects can be modified by their name. If the name does not exist, set will append a new member.
jsonObject.set("quantity", 24);
jsonObject.remove("quantity");JsonObject also provides a merge method that copies all members from a given JSON object.
jsonObject.merge(otherObject);The toString method of a JsonValue returns valid JSON strings.
You can also write to a java.io.Writer using writeTo:
String json = jsonValue.toString();
jsonValue.writeTo(writer);Both methods accept an additonal parameter to enable formatted output:
String json = jsonValue.toString(WriterConfig.PRETTY_PRINT);
jsonValue.writeTo(writer, WriterConfig.PRETTY_PRINT);
…
xml
com.eclipsesource.minimal-json
minimal-json
0.9.5
Development snapshots are available on oss.sonatype.org.
To build minimal-json on your machine, checkout the repository, cd into it, and call:
mvn clean installA continuous integration build is running at Travis-CI.
The code is available under the terms of the MIT License.
No open issues yet, or sync has not completed.