You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writer should always produce well-formed JSON. Invalid sequence of events should be detected via assertion. However, currently generating two or more JSONs into output stream does not generate assertion fail. For example,
So that, error of multiple root elements can be detected, and also Writer object can be reused. The advantage of reusing an Writer object is to prevent reallocating memory for Writer's internal data structure (basically a stack).
The text was updated successfully, but these errors were encountered:
Writer
should always produce well-formed JSON. Invalid sequence of events should be detected via assertion. However, currently generating two or more JSONs into output stream does not generate assertion fail. For example,Writer<Stream> writer(stream); writer.StartObject(); writer.EndObject(); writer.StartObject(); writer.EndObject();
Will output
{}{}
to the stream.I suggest that an explicitly reset API should be added:
Writer<Stream> writer(stream); writer.StartObject(); writer.EndObject(); writer.Reset(newStream); writer.StartObject(); writer.EndObject();
So that, error of multiple root elements can be detected, and also
Writer
object can be reused. The advantage of reusing anWriter
object is to prevent reallocating memory forWriter
's internal data structure (basically a stack).The text was updated successfully, but these errors were encountered: