Json.state

Save or restore the parser's internal state.

If you want to read only a certain object from the JSON, but exactly which depends on the value of some key, this is where saving and restoring the parser state helps.

Before each candidate you save the parser state. Then you perform just the minimal work to test if the candidate matches some criteria. If it does, restore the parser state and read the elements in full. Of it doesn't, just skip to the next.

  1. const(JsonParserState) state [@property getter]
    struct Json(uint vl = validateUsed, bool validateUtf8 = vl > trustedSource)
    @property const
    state
    ()
    if (
    vl > trustedSource ||
    !validateUtf8
    )
  2. JsonParserState state [@property setter]

Meta