Skip to content

Jackson JSON I/O helper classes. As simple as Json.stringify(obj, System.out) and Json.parse(str, MyObj.class)!

License

Notifications You must be signed in to change notification settings

TeamworkGuy2/JsonIo

Repository files navigation

JsonIo

version: 0.1.2

Simple static and instance classes for easy Jackson (https://github.com/FasterXML) serialization/deserialization. Includes ObjectMapper wrapper 'JsonInst' and ObjectMapper builder 'JsonBuilder'.


JSON Instance:

public static JsonInst getJsonInst() {
	JsonBuilder jsonBldr = new JsonBuilder();

	jsonBldr.addSerializeDeserializer(Path.class, new Json.PathSerializer(), new Json.PathDeserializer());
	jsonBldr.addSerializeDeserializer(ZonedDateTime.class, Json.ZonedDateTimeSerializer.iso8601Formatter(), Json.ZonedDateTimeDeserializer.iso8601Formatter());
	jsonBldr.getSerializeDeserializeModule().addAbstractTypeMapping(Entry.class, AbstractMap.SimpleImmutableEntry.class);

	JsonInst json = jsonBldr.build();
	json.setAllowUnquotedFieldNames(true);
	json.setPrettyPrint(true);
	return json;
}

About

Jackson JSON I/O helper classes. As simple as Json.stringify(obj, System.out) and Json.parse(str, MyObj.class)!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages