My scenario is very complicated but here\'s a summary:
I\'m trying to understand source of a compiler -- and to understand what each AST node represents, I\'m generating
You can also use Genson to add class name of your objects to the outputed json, just do:
Genson genson = new Genson.Builder().setWithClassMetadata(true).create();
String json = genson.serialize(yourNode);
The nice thing is that it enables you to deserialize back to those concrete types. See the wiki for more details.