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
Nested Classes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarray()voidclose()voidflush()object()pop()voidsetOutputType(JsonWriter.OutputType outputType) Sets the type of JSON output.voidsetQuoteLongValues(boolean quoteLongValues) When true, quotes long, double, BigInteger, BigDecimal types to prevent truncation in languages like JavaScript and PHP.voidwrite(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:
setOutputTypein 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:
setQuoteLongValuesin interfaceBaseJsonWriter
-
name
- Specified by:
namein interfaceBaseJsonWriter- Throws:
IOException
-
object
- Specified by:
objectin interfaceBaseJsonWriter- Throws:
IOException
-
array
- Specified by:
arrayin interfaceBaseJsonWriter- Throws:
IOException
-
value
- Specified by:
valuein interfaceBaseJsonWriter- Throws:
IOException
-
object
- Specified by:
objectin interfaceBaseJsonWriter- Throws:
IOException
-
array
- Specified by:
arrayin interfaceBaseJsonWriter- Throws:
IOException
-
set
- Specified by:
setin interfaceBaseJsonWriter- Throws:
IOException
-
pop
- Specified by:
popin interfaceBaseJsonWriter- Throws:
IOException
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-