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
Gson provides an option to custom serialize and descrialize an object, by implementing the interface JsonSerializer (for serializing) and JsonDeserializer (for descralizing) you can ignore some parts of the JSON string (say _class:com.example.SomeSourceClass).
This would also mean that a generic/regular Gson isntance will fail to read your JSON string.
This would be a specific solution to your problem.
Here is the Gson Userguide