Adds a string key-value pair to a JSON object with proper escaping.
Takes json string, key string, and value string.
Returns modified json via ReturnString.
JSON
Parameters & Returns
Parameters
jsonString
keyString
valueString
Returns
String
Quick Summary
Adds a string key-value pair to a JSON object with proper escaping.
Takes json string, key string, and value string.
Returns modified json via ReturnString.
Technical Exegesis...
Adds a string key-value pair to a JSON object with proper escaping. Takes json string, key string, and value string. Calls NeedsComma to check if comma needed. If comma needed, appends ",". Appends "\"key\":\"escapedValue\"" format. Calls EscapeJSONString to escape special characters: \" -> \\\", \\ -> \\\\, \\b -> \\b, \\f -> \\f, \\n -> \\n, \\r -> \\r, \\t -> \\t. Returns modified json via ReturnString.
This function adds string field to JSON object with proper JSON escaping.
Adds a string key-value pair to a JSON object with proper escaping. Takes json string, key string, and value string. Calls NeedsComma to check if comma needed. If comma needed, appends ",". Appends "\"key\":\"escapedValue\"" format. Calls EscapeJSONString to escape special characters: \" -> \\\", \\ -> \\\\, \\b -> \\b, \\f -> \\f, \\n -> \\n, \\r -> \\r, \\t -> \\t. Returns modified json via ReturnString.
This function adds string field to JSON object with proper JSON escaping. NeedsComma helper prevents syntax errors. Format is JSON standard: "key":"value". EscapeJSONString handles special characters to prevent JSON syntax errors and preserve control characters. Essential for strings containing quotes, backslashes, or newlines. Use for text properties in JSON documents. Common pattern: json = jsonWriteString(json, "name", "Player One"), json = jsonWriteString(json, "message", "Hello\\nWorld"). Escaping is automatic - don't manually escape input strings. Supports UTF-8 text.