Class JsonWriterCloseable

java.lang.Object
com.aspectran.utils.json.JsonWriter
com.aspectran.utils.json.JsonWriterCloseable
All Implemented Interfaces:
Closeable, AutoCloseable

public class JsonWriterCloseable extends JsonWriter implements Closeable
Converts an object to a JSON formatted string.

If pretty-printing is enabled, the JsonWriter will add newlines and indentation to the written data. Pretty-printing is disabled by default.

Useful with Java 7 for example :


   try(JsonWriterCloseable jsonWriter = JsonWriterCloseable(out)) {
     ....
   }
 

Created: 2008. 06. 12 PM 8:20:54

Author:
Juho Jeong
  • Constructor Details

    • JsonWriterCloseable

      public JsonWriterCloseable(Writer writer)
      Instantiates a new JsonWriter. Pretty printing is enabled by default, and the indent string is set to " " (two spaces).
      Parameters:
      writer - the character-output stream