use of org.structr.rest.adapter.ResultGSONAdapter in project structr by structr.
the class ThreadLocalGson method initialValue.
@Override
protected Gson initialValue() {
final ResultGSONAdapter resultGsonAdapter = new ResultGSONAdapter(propertyView, outputNestingDepth);
final JsonInputGSONAdapter jsonInputAdapter = new JsonInputGSONAdapter();
// create GSON serializer
final GsonBuilder gsonBuilder = new GsonBuilder().setPrettyPrinting().serializeNulls().registerTypeHierarchyAdapter(FrameworkException.class, new FrameworkExceptionGSONAdapter()).registerTypeAdapter(IJsonInput.class, jsonInputAdapter).registerTypeAdapter(Result.class, resultGsonAdapter);
final boolean lenient = Settings.JsonLenient.getValue();
if (lenient) {
// Serializes NaN, -Infinity, Infinity, see http://code.google.com/p/google-gson/issues/detail?id=378
gsonBuilder.serializeSpecialFloatingPointValues();
}
return gsonBuilder.create();
}
Aggregations