klyn.Object.toJson
method
public toJson(exclude as List<String> = null, spaces as Boolean = true, pretty as Boolean = false, indent as Int = 0) as String:
DescriptionReturns the object as JSON text.
Compact output is produced by default. Pretty output uses an indented
multi-line format delegated to `JSON.stringify(...)`.
a default indentation of 4 spaces is used.
import klyn.math
r = Rational(3, 4)
print(r.toJson(pretty=true, indent=2))
ReturnsJSON representation of the object. ```klyn import klyn.math r = Rational(3, 4) print(r.toJson(pretty=true, indent=2)) ```