Quick answer: Construct 3 Array.AsJSON producing invalid JSON when values contain emoji? UTF-16 surrogate pairs not escaped properly - sanitize before serialize or use a custom encoder.
Chat log saved via Array.AsJSON. After a message with emoji, the file fails to parse.
Strip non-BMP chars
Pre-sanitize: remove characters above U+FFFF (4-byte UTF-8). Loses emoji; saves the JSON.
Or escape via JS
JSON.stringify(value)The runtime's JSON.stringify handles surrogate pairs correctly. Bypass Construct's encoder for emoji-rich strings.
Test with a chat sample
Sample text with mixed scripts and emoji. Round-trip through your save system; verify integrity.
“Construct 3's JSON encoder predates emoji prevalence. Modern strings need a modern encoder.”
If your game persists user text, test with international characters. Latin-only tests miss a lot.