@Test void test() { CompilationUnit cu = parse("class X{java.util.Y y;}"); String serialized = serialize(cu, false); assertEquals("{\"!\":\"com.github.javaparser.ast.CompilationUnit\",\"range\":{\"beginLine\":1,\"beginColumn\":1,\"endLine\":1,\"endColumn\":23},\"tokenRange\":{\"beginToken\":{\"kind\":19,\"text\":\"class\"},\"endToken\":{\"kind\":0,\"text\":\"\"}},\"imports\":[],\"types\":[{\"!\":\"com.github.javaparser.ast.body.ClassOrInterfaceDeclaration\",\"range\":{\"beginLine\":1,\"beginColumn\":1,\"endLine\":1,\"endColumn\":23},\"tokenRange\":{\"beginToken\":{\"kind\":19,\"text\":\"class\"},\"endToken\":{\"kind\":99,\"text\":\"}\"}},\"extendedTypes\":[],\"implementedTypes\":[],\"isInterface\":\"false\",\"typeParameters\":[],\"members\":[{\"!\":\"com.github.javaparser.ast.body.FieldDeclaration\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":22},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"java\"},\"endToken\":{\"kind\":102,\"text\":\";\"}},\"modifiers\":[],\"variables\":[{\"!\":\"com.github.javaparser.ast.body.VariableDeclarator\",\"range\":{\"beginLine\":1,\"beginColumn\":21,\"endLine\":1,\"endColumn\":21},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"y\"},\"endToken\":{\"kind\":93,\"text\":\"y\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":21,\"endLine\":1,\"endColumn\":21},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"y\"},\"endToken\":{\"kind\":93,\"text\":\"y\"}},\"identifier\":\"y\"},\"type\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":19},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"java\"},\"endToken\":{\"kind\":93,\"text\":\"Y\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":19,\"endLine\":1,\"endColumn\":19},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"Y\"},\"endToken\":{\"kind\":93,\"text\":\"Y\"}},\"identifier\":\"Y\"},\"scope\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":17},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"java\"},\"endToken\":{\"kind\":93,\"text\":\"util\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":14,\"endLine\":1,\"endColumn\":17},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"util\"},\"endToken\":{\"kind\":93,\"text\":\"util\"}},\"identifier\":\"util\"},\"scope\":{\"!\":\"com.github.javaparser.ast.type.ClassOrInterfaceType\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":12},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"java\"},\"endToken\":{\"kind\":93,\"text\":\"java\"}},\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":9,\"endLine\":1,\"endColumn\":12},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"java\"},\"endToken\":{\"kind\":93,\"text\":\"java\"}},\"identifier\":\"java\"},\"annotations\":[]},\"annotations\":[]},\"annotations\":[]}}],\"annotations\":[]}],\"modifiers\":[],\"name\":{\"!\":\"com.github.javaparser.ast.expr.SimpleName\",\"range\":{\"beginLine\":1,\"beginColumn\":7,\"endLine\":1,\"endColumn\":7},\"tokenRange\":{\"beginToken\":{\"kind\":93,\"text\":\"X\"},\"endToken\":{\"kind\":93,\"text\":\"X\"}},\"identifier\":\"X\"},\"annotations\":[]}]}", serialized); }
public void serialize(Node node, JsonGenerator generator) { requireNonNull(node); Log.info("Serializing Node to JSON."); try { serialize(null, node, generator); } finally { generator.close(); } }
JavaParserJsonSerializer { public void serialize(Node node, JsonGenerator generator) { requireNonNull(node); Log.info("Serializing Node to JSON."); try { serialize(null, node, generator); } finally { generator.close(); } } }
JavaParserJsonSerializer { public void serialize(Node node, JsonGenerator generator) { requireNonNull(node); Log.info("Serializing Node to JSON."); try { serialize(null, node, generator); } finally { generator.close(); } }  }
JavaParserJsonSerializer { public void serialize(Node node, JsonGenerator generator) { requireNonNull(node); Log.info("Serializing Node to JSON."); try { serialize(null, node, generator); } finally { generator.close(); } }  void serialize(Node node, JsonGenerator generator); }
JavaParserJsonSerializer { public void serialize(Node node, JsonGenerator generator) { requireNonNull(node); Log.info("Serializing Node to JSON."); try { serialize(null, node, generator); } finally { generator.close(); } }  void serialize(Node node, JsonGenerator generator);  }