public static stringify(writer as TextWriter, value as Object, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String throws JSONWriteException, IOException:
Serializes a value and writes it to a text writer.
| Parameter | Description |
|---|---|
writer | Destination writer. |
value | Value to serialize, including null. |
spaces | When pretty is false, controls compact spacing. |
pretty | Enables multi-line formatting. |
indent | Indentation width when pretty is true. |
The same JSON text written to writer.
try writer = FileWriter("settings.json"):
JSON.stringify(writer, {"theme": "dark"})