public static XMLStreamWriter createWriter(Writer writer, JSONConfiguration config, boolean writingList) throws IOException {
switch (config.getNotation()) {
case NATURAL:
final JsonGenerator rawGenerator = new JsonFactory().createJsonGenerator(writer);
if (config.isHumanReadableFormatting()) {
rawGenerator.useDefaultPrettyPrinter();
}
final JsonGenerator bodyGenerator = writingList ? JacksonArrayWrapperGenerator.createArrayWrapperGenerator(rawGenerator, config.isRootUnwrapping() ? 0 : 1) : rawGenerator;
if (config.isRootUnwrapping()) {
return new Stax2JacksonWriter(JacksonRootStrippingGenerator.createRootStrippingGenerator(bodyGenerator, writingList ? 2 : 1), config);
} else {