public class JsonWriter extends Writer
| Modifier and Type | Class and Description |
|---|---|
static class |
JsonWriter.OutputType |
| Constructor and Description |
|---|
JsonWriter(Writer writer) |
| Modifier and Type | Method and Description |
|---|---|
JsonWriter |
array() |
JsonWriter |
array(String name) |
void |
close() |
void |
flush() |
Writer |
getWriter() |
JsonWriter |
json(String json)
Writes the specified JSON value, without quoting or escaping.
|
JsonWriter |
json(String name,
String json)
Writes the specified JSON value, without quoting or escaping.
|
JsonWriter |
name(String name) |
JsonWriter |
object() |
JsonWriter |
object(String name) |
JsonWriter |
pop() |
JsonWriter |
set(String name,
Object value) |
void |
setOutputType(JsonWriter.OutputType outputType)
Sets the type of JSON output.
|
void |
setQuoteLongValues(boolean quoteLongValues)
When true, quotes long, double, BigInteger, BigDecimal types to prevent truncation in languages like JavaScript and PHP.
|
JsonWriter |
value(Object value) |
void |
write(char[] cbuf,
int off,
int len) |
public JsonWriter(Writer writer)
public Writer getWriter()
public void setOutputType(JsonWriter.OutputType outputType)
JsonWriter.OutputType.minimal.public void setQuoteLongValues(boolean quoteLongValues)
public JsonWriter name(String name) throws IOException
IOExceptionpublic JsonWriter object() throws IOException
IOExceptionpublic JsonWriter array() throws IOException
IOExceptionpublic JsonWriter value(Object value) throws IOException
IOExceptionpublic JsonWriter json(String json) throws IOException
IOExceptionpublic JsonWriter object(String name) throws IOException
IOExceptionpublic JsonWriter array(String name) throws IOException
IOExceptionpublic JsonWriter set(String name, Object value) throws IOException
IOExceptionpublic JsonWriter json(String name, String json) throws IOException
IOExceptionpublic JsonWriter pop() throws IOException
IOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionCopyright © 2021. All rights reserved.