A fluent builder for Google Gson
Java
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.md
pom.xml

README.md

fluent-json

A fluent builder for Google Gson

See website for more details http://jglue.org/fluent-json/

<dependency>
  <groupId>org.jglue.fluent-json</groupId>
  <artifactId>fluent-json</artifactId>
  <version>1.0.0</version>
</dependency>
JsonObject jsonObject = 
	JsonBuilderFactory.buildObject()
		.add("prop1", "1")
		.add("prop2", 2)
		.addNull("prop3")
		.add("prop4", (String)null)
		.addObject("prop5")
			.add("np1", 4)
			.end()
		.addArray("prop6")
			.addObject()
				.end()
			.add("ae1")
		.end()
	.getJson();
{
	prop1: "1",
	prop2: 2,
	prop3: null,
	prop4: null,
	prop5: {
			np1: 4
		},
	prop6: [
			{},
			"ae1"
		]
}

Copyright 2013 Bryn Cooke

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.