public String toJson ( ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; mapper . writeValue ( out , this ) ; return out . toString ( ) ; }
Converts a resource to JSON .