An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Json Compose [![Build Status](https://travis-ci.org/mitchhentges/json-compose.svg?branch=master)](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)