begin Flatten
Cancels immediately-nested calls to beginArray or beginObject and theirmatching calls to endArray or endObject. Use this to compose JSON adapterswithout nesting.
For example, the following creates JSON with nested arrays: {@code [1,[2,3,4],5]}
.
{@code * JsonAdapter
With flattening we can create JSON with a single array {@code [1,2,3,4,5]}
:
{@code * JsonAdapter
This method flattens arrays within arrays:
{@code * Emit: [1, [2, 3, 4], 5] * To produce: [1, 2, 3, 4, 5] * }
{@code * Emit: {"a": 1, {"b": 2}, "c": 3} * To Produce: {"a": 1, "b": 2, "c": 3} * }
{@code * Emit: [1, {"b": 2}, 3, [4, 5], 6] * To Produce: [1, {"b": 2}, 3, 4, 5, 6] * }
This method returns an opaque token. Callers must match all calls to this method with a callto endFlatten with the matching token.