A tool to quickly compose Java maps and lists of primitives into JSON strings. For parsing JSON strings, see Json Parse
List<Object> list = Arrays.listOf(1, "two", null);
Map<String, Object> map = new HashMap<>();
map.put("key", "value");
JsonCompose.compose(list); //[1,\"two\",null]
JsonCompose.compose(map); //{\"key\":\"value\"}
Maven
<dependency>
<groupId>ca.fuzzlesoft</groupId>
<artifactId>json-compose</artifactId>
<version>1.0.3</version>
</dependency>
Gradle
compile 'ca.fuzzlesoft:json-compose:1.0.3'
So long as only primitives, Map
s or Collection
s are provided, any nested model can be composed into a JSON string.
Call JsonCompose
from as many different threads as you want, it will handle it like a champ.
- Like Json-Parse, does this provide a "path" to composition errors?
That will be implemented in the future, but not yet