JsonUtils { public static Node valueToNode(Object source) { if (source instanceof Node) { return (Node) source; } else { return converter.valueToNode(source); } }  static Node convertToJson(Object source, String label); static Node convertToJson(Object source, String label, boolean lenient); static Node valueToNode(Object source); static Node getNode(Object root, String path); static Node getNode(Object root, Path path); @Deprecated static boolean nodeExists(Object json, String path); static boolean nodeAbsent(Object json, String path, Configuration configuration); static boolean nodeAbsent(Object json, Path path, Configuration configuration); static Object jsonSource(final Object json, final String pathPrefix); static String getPathPrefix(Object json); static Node wrapDeserializedObject(Object source); static Object missingNode();  }
@Test void testValueToJson() { assertEquals(STRING, valueToNode("a").getNodeType()); assertEquals(NUMBER, valueToNode(BigDecimal.valueOf(1)).getNodeType()); assertEquals(STRING, valueToNode("1").getNodeType()); assertEquals(NUMBER, valueToNode(1.0).getNodeType()); assertEquals(STRING, valueToNode("1.0").getNodeType()); assertEquals(OBJECT, valueToNode(singletonMap("a", 1)).getNodeType()); assertEquals(ARRAY, valueToNode(new int[]{1 ,2, 3}).getNodeType()); assertEquals(STRING, valueToNode("true").getNodeType()); assertEquals(BOOLEAN, valueToNode(true).getNodeType()); assertEquals(STRING, valueToNode("false").getNodeType()); assertEquals(BOOLEAN, valueToNode(false).getNodeType()); assertEquals(STRING, valueToNode("null").getNodeType()); assertEquals(NULL, valueToNode(null).getNodeType()); }