From ef68625a4c340e45dadb1366659f6802c219f26a Mon Sep 17 00:00:00 2001 From: John Bytheway Date: Sun, 6 Oct 2019 21:35:09 -0400 Subject: [PATCH] Document the new JsonObject behaviour --- src/json.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/json.h b/src/json.h index d271a10970405..70dd8e12b4722 100644 --- a/src/json.h +++ b/src/json.h @@ -758,6 +758,21 @@ class JsonOut * if (!jo.read("messages", messages)) { * DebugLog() << "No messages."; * } + * + * + * Automatic error checking + * ------------------------ + * + * By default, when a JsonObject is destroyed (or when you call finish) it will + * check to see whether every member of the object was referenced in some way + * (even simply checking for the existence of the member is suffucient). + * + * If not all the members were referenced, then an error will be written to the + * log (which in particular will cause the tests to fail). + * + * If you don't want this behaviour, then call allow_omitted_members() before + * the JsonObject is destroyed. Calling str() also suppresses it (on the basis + * that you may be intending to re-parse that string later). */ class JsonObject {