Json Adapter
Converts Java values to JSON, and JSON values to Java.
JsonAdapter instances provided by Moshi are thread-safe, meaning multiple threads can safely use a single instance concurrently.
Custom JsonAdapter implementations should be designed to be thread-safe.
Types
Functions
fail On Unknown
Link copied to clipboard
Returns a JSON adapter equal to this, but that throws a JsonDataException when unknown names and values are encountered.
from Json Value
Link copied to clipboard
Decodes a Java value object from
value, which must be comprised of maps, lists, strings, numbers, booleans and nulls.indent
Link copied to clipboard
Return a JSON adapter equal to this, but using
indent to control how the result is formatted.lenient
Link copied to clipboard
Returns a JSON adapter equal to this, but is lenient when reading and writing.
non Null
Link copied to clipboard
Returns a JSON adapter equal to this JSON adapter, but that refuses null values.
null Safe
Link copied to clipboard
Returns a JSON adapter equal to this JSON adapter, but with support for reading and writing nulls.
serialize Nulls
Link copied to clipboard
Returns a JSON adapter equal to this JSON adapter, but that serializes nulls when encoding JSON.
to Json
Link copied to clipboard
Encodes the given
value into a String and returns it.Encodes the given
value with the given writer.to Json Value
Link copied to clipboard
Encodes
value as a Java value object comprised of maps, lists, strings, numbers, booleans, and nulls.