@Test void testYamlToJson() throws Exception { ContentHandle yaml = ContentHandle.create(YAML_CONTENT); ContentHandle json = ContentTypeUtil.yamlToJson(yaml); Assertions.assertEquals(normalize(JSON_CONTENT), normalize(json.content())); }
public static ContentHandle yamlToJson(ContentHandle yaml) { try { JsonNode root = yamlMapper.readTree(yaml.stream()); return ContentHandle.create(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(root)); } catch (Throwable t) { return yaml; } }
ContentTypeUtil { public static ContentHandle yamlToJson(ContentHandle yaml) { try { JsonNode root = yamlMapper.readTree(yaml.stream()); return ContentHandle.create(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(root)); } catch (Throwable t) { return yaml; } } }
ContentTypeUtil { public static ContentHandle yamlToJson(ContentHandle yaml) { try { JsonNode root = yamlMapper.readTree(yaml.stream()); return ContentHandle.create(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(root)); } catch (Throwable t) { return yaml; } }  }
ContentTypeUtil { public static ContentHandle yamlToJson(ContentHandle yaml) { try { JsonNode root = yamlMapper.readTree(yaml.stream()); return ContentHandle.create(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(root)); } catch (Throwable t) { return yaml; } }  static boolean isApplicationJson(String ct); static boolean isApplicationYaml(String ct); static ContentHandle yamlToJson(ContentHandle yaml); }
ContentTypeUtil { public static ContentHandle yamlToJson(ContentHandle yaml) { try { JsonNode root = yamlMapper.readTree(yaml.stream()); return ContentHandle.create(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(root)); } catch (Throwable t) { return yaml; } }  static boolean isApplicationJson(String ct); static boolean isApplicationYaml(String ct); static ContentHandle yamlToJson(ContentHandle yaml); static final String CT_APPLICATION_JSON; static final String CT_APPLICATION_YAML; static final String CT_APPLICATION_XML; }