Package arc.util.serialization
Class JsonWriter
java.lang.Object
java.io.Writer
arc.util.serialization.JsonWriter
- All Implemented Interfaces:
BaseJsonWriter
,Closeable
,Flushable
,Appendable
,AutoCloseable
Builder style API for emitting JSON.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionarray()
void
close()
void
flush()
object()
pop()
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.void
write
(char[] cbuf, int off, int len)
-
Constructor Details
-
JsonWriter
-
-
Method Details
-
getWriter
-
setOutputType
Sets the type of JSON output. Default isJsonWriter.OutputType.minimal
.- Specified by:
setOutputType
in interfaceBaseJsonWriter
-
setQuoteLongValues
public void setQuoteLongValues(boolean quoteLongValues) When true, quotes long, double, BigInteger, BigDecimal types to prevent truncation in languages like JavaScript and PHP. This is not necessary when using arc, which handles these types without truncation. Default is false.- Specified by:
setQuoteLongValues
in interfaceBaseJsonWriter
-
name
- Specified by:
name
in interfaceBaseJsonWriter
- Throws:
IOException
-
object
- Specified by:
object
in interfaceBaseJsonWriter
- Throws:
IOException
-
array
- Specified by:
array
in interfaceBaseJsonWriter
- Throws:
IOException
-
value
- Specified by:
value
in interfaceBaseJsonWriter
- Throws:
IOException
-
object
- Specified by:
object
in interfaceBaseJsonWriter
- Throws:
IOException
-
array
- Specified by:
array
in interfaceBaseJsonWriter
- Throws:
IOException
-
set
- Specified by:
set
in interfaceBaseJsonWriter
- Throws:
IOException
-
pop
- Specified by:
pop
in interfaceBaseJsonWriter
- Throws:
IOException
-
write
- Specified by:
write
in classWriter
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-