package name.matco.simcity.api;

import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

@Provider
public class ObjectMapperResolver implements ContextResolver<ObjectMapper> {

	private final ObjectMapper mapper;

	public ObjectMapperResolver() {
		mapper = new ObjectMapper();
		mapper.enable(SerializationFeature.INDENT_OUTPUT);
	}

	@Override
	public ObjectMapper getContext(final Class<?> type) {
		return mapper;
	}
}

@@ -26,16 +26,85 @@
 y.api;%0A%0A
+import java.io.IOException;%0A%0Aimport javax.ws.rs.core.MultivaluedMap;%0A
 import j
@@ -202,331 +202,1077 @@
 son.
-databind.ObjectMapper;%0Aimport com.fasterxml.jackson.databind.SerializationFeature;%0A%0A@Provider%0Apublic class ObjectMapperResolver implements ContextResolver%3CObjectMapper%3E %7B%0A%0A%09private final ObjectMapper mapper;%0A%0A%09public ObjectMapperResolver() %7B%0A%09%09mapper = new ObjectMapper();%0A%09%09mapper.enable(SerializationFeature.INDENT_OUTPUT
+core.JsonGenerator;%0Aimport com.fasterxml.jackson.core.util.DefaultIndenter;%0Aimport com.fasterxml.jackson.core.util.DefaultPrettyPrinter;%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.fasterxml.jackson.databind.ObjectWriter;%0Aimport com.fasterxml.jackson.jaxrs.cfg.EndpointConfigBase;%0Aimport com.fasterxml.jackson.jaxrs.cfg.ObjectWriterInjector;%0Aimport com.fasterxml.jackson.jaxrs.cfg.ObjectWriterModifier;%0A%0A@Provider%0Apublic class ObjectMapperResolver implements ContextResolver%3CObjectMapper%3E %7B%0A%0A%09private final ObjectMapper mapper;%0A%0A%09public ObjectMapperResolver() %7B%0A%09%09mapper = new ObjectMapper();%0A%09%09ObjectWriterInjector.set(new ObjectWriterModifier() %7B%0A%09%09%09@Override%0A%09%09%09public ObjectWriter modify(final EndpointConfigBase%3C?%3E endpoint, final MultivaluedMap%3CString, Object%3E responseHeaders, final Object valueToWrite, final ObjectWriter w, final JsonGenerator g) throws IOException %7B%0A%09%09%09%09final DefaultPrettyPrinter pp = new DefaultPrettyPrinter();%0A%09%09%09%09pp.indentObjectsWith(new DefaultIndenter(%22%5Ct%22, %22%5Cn%22));%0A%09%09%09%09g.setPrettyPrinter(pp);%0A%09%09%09%09return w;%0A%09%09%09%7D%0A%09%09%7D
 );%0A%09

Improve indentation of JSON content from REST API