Package io.activej.codec.json
Class JsonUtils
java.lang.Object
io.activej.codec.json.JsonUtils
public class JsonUtils extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonUtils.JsonWriterEx -
Constructor Summary
Constructors Constructor Description JsonUtils() -
Method Summary
Modifier and Type Method Description static <T> TfromJson(StructuredDecoder<T> decoder, String string)static <T> StructuredCodec<T>indent(StructuredCodec<T> codec, String indent)static <T> StructuredCodec<T>oneline(StructuredCodec<T> codec)static <T> StringtoJson(StructuredEncoder<? super T> encoder, T value)static <T> voidtoJson(StructuredEncoder<? super T> encoder, T value, Appendable appendable)Encodes a given value as a JSON usingStructuredEncoderand appends the result to theAppendable.static <T> ByteBuftoJsonBuf(StructuredEncoder<? super T> encoder, T value)
-
Constructor Details
-
JsonUtils
public JsonUtils()
-
-
Method Details
-
fromJson
public static <T> T fromJson(StructuredDecoder<T> decoder, String string) throws MalformedDataException- Throws:
MalformedDataException
-
toJson
-
toJsonBuf
-
toJson
public static <T> void toJson(StructuredEncoder<? super T> encoder, T value, Appendable appendable)Encodes a given value as a JSON usingStructuredEncoderand appends the result to theAppendable. PassedAppendableshould not perform any blocking I/O operations- Type Parameters:
T- type of value to be encoded- Parameters:
encoder- structured encodervalue- a value to be encoded to JSONappendable- nonblocking appendable where an encoded as json value will be appended
-
oneline
-
indent
-