Function JsonDecoder.skipComposite

Assuming the start of an array/object has been read, keep reading until its end is found.

void skipComposite();

Example

string data = `{ "A": 3, "B": { "C": 4 } }`;
auto decoder = jsonDecoder(data);
with (decoder) {
  assert(readMapStart() == 1);
  assert(readString() == "A");
  assert(readInt() == 3);
  assert(readMapNext() == 1);
  assert(readString() == "B");
  assert(readMapStart() == 1);
  assert(readString() == "C");
  assert(readInt() == 4);
  assert(readMapNext() == 0);
  assert(readMapNext() == 0);
}

Example

import avro.name : Name;
import avro.schema : UnionSchema, NullSchema, BooleanSchema, IntSchema;

Schema schema = new UnionSchema([new NullSchema(), new BooleanSchema(), new IntSchema()]);
string data = `null {"boolean": true} {"int": 3}`;
auto decoder = jsonDecoder(data);
with (decoder) {
  assert(readUnionIndex(schema) == 0);
  readNull();
  assert(readUnionIndex(schema) == 1);
  assert(readBoolean() == true);
  readUnionEnd();
  assert(readUnionIndex(schema) == 2);
  assert(readInt() == 3);
  readUnionEnd();
}