StringWriter writer = new StringWriter();
JsonGenerator gen;
try {
gen = new JsonFactory().createGenerator(writer);
gen.setCodec(new ObjectMapper());
gen.writeTree(toJson(mapping));
gen.close();
} catch (IOException e) {
throw new DatasetIOException("Cannot write to JSON generator", e);
}
return writer.toString();