一个快速而小巧的 JSON 分析器和写入器,适用于 Java
我很高兴看到 minimal-json 仍然在使用,但我再也无法维护这个项目了。如果有人积极维护一个遵循 minimal-json 理念的分支,我很乐意在此链接到这个仓库。谢谢。 一个用于 Java 的快速且简洁的 JSON 解析器和写入器。 它不是一个对象映射器,而是一个简单的库,旨在
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);
### Modify JSON arrays and objects
You can replace or remove array elements based on their index. The index must be valid.
java 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.
java jsonObject.set("quantity", 24); jsonObject.remove("quantity");
`JsonObject` also provides a `merge` method that copies all members from a given JSON object.
java jsonObject.merge(otherObject);
### Output JSON
The `toString` method of a `JsonValue` returns valid JSON strings.
You can also write to a `java.io.Writer` using `writeTo`:
java String json = jsonValue.toString(); jsonValue.writeTo(writer);
Both methods accept an additonal parameter to enable formatted output:
java 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](https://oss.sonatype.org/content/repositories/snapshots/com/eclipsesource/minimal-json/minimal-json/).
Build
-----
To build minimal-json on your machine, checkout the repository, `cd` into it, and call:mvn clean install
连续集成构建正在 [Travis-CI](https://travis-ci.org/ralf) 运行中暂无开放 Issues,或尚未同步最近议题。