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.
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.