https://github.com/mitchhentges/json-compose
Map/List to JSON composer
https://github.com/mitchhentges/json-compose
converter formatter java json json-string
Last synced: 6 months ago
JSON representation
Map/List to JSON composer
- Host: GitHub
- URL: https://github.com/mitchhentges/json-compose
- Owner: mitchhentges
- Created: 2016-08-18T07:54:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T19:43:51.000Z (about 9 years ago)
- Last Synced: 2025-01-29T16:11:23.502Z (about 1 year ago)
- Topics: converter, formatter, java, json, json-string
- Language: Java
- Size: 10.7 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Json Compose [](https://travis-ci.org/mitchhentges/json-compose)
A tool to quickly compose Java maps and lists of primitives into JSON strings.
For parsing JSON strings, see [Json Parse](https://github.com/mitchhentges/json-parse/)
## Usage
```
List list = Arrays.listOf(1, "two", null);
Map map = new HashMap<>();
map.put("key", "value");
JsonCompose.compose(list); //[1,\"two\",null]
JsonCompose.compose(map); //{\"key\":\"value\"}
```
## Getting the dependency
**Maven**
```
ca.fuzzlesoft
json-compose
1.0.3
```
**Gradle**
```
compile 'ca.fuzzlesoft:json-compose:1.0.3'
```
## Features
### Composes nested Java containers of primitives
So long as only primitives, `Map`s or `Collection`s are provided, any nested model can be composed into a JSON string.
### Thread safe
Call `JsonCompose` from as many different threads as you want, it will handle it like a champ.
## FAQ
* Like [Json-Parse](https://github.com/mitchhentges/json-parse), does this provide a "path" to composition errors?
That will be implemented in the future, but not yet
## License
[MIT License (Expat)](http://www.opensource.org/licenses/mit-license.php)