Adds an integer key-value pair to a JSON object.
Takes json string, key string, and integer value.
Returns modified json via ReturnString.
JSON
Parameters & Returns
Parameters
jsonString
keyString
valueInt
Returns
String
Quick Summary
Adds an integer key-value pair to a JSON object.
Takes json string, key string, and integer value.
Returns modified json via ReturnString.
Technical Exegesis...
Adds an integer key-value pair to a JSON object. Takes json string, key string, and integer value. Calls NeedsComma to check if comma needed (returns true if last non-whitespace char is not '{' or '['). If comma needed, appends ",". Appends "\"key\":value" format. Converts value to string with std::to_string. Returns modified json via ReturnString.
This function adds integer field to JSON object. NeedsComma helper prevents syntax errors by adding comma between fields. Format is JSON standard: "key":123.
Adds an integer key-value pair to a JSON object. Takes json string, key string, and integer value. Calls NeedsComma to check if comma needed (returns true if last non-whitespace char is not '{' or '['). If comma needed, appends ",". Appends "\"key\":value" format. Converts value to string with std::to_string. Returns modified json via ReturnString.
This function adds integer field to JSON object. NeedsComma helper prevents syntax errors by adding comma between fields. Format is JSON standard: "key":123. No quotes around number value. Handles negative numbers correctly. Use for integer properties in JSON documents. Common pattern: json = jsonWriteInt(json, "score", 100), json = jsonWriteInt(json, "lives", 3). Chain multiple calls to add multiple fields. Order of fields is preserved. Works for both positive and negative integers.