An interface for reading and writing JSON. This interface will be used when an Object needs to be read or written to JSON. These methods return a specific object and not the interface JsonSerializable. Objects implementing this interface have the ability to persist custom data to the JSON output. This custom data is stored as a MutableDictionaryImpl where the keys are strings that represent properties on the Object, and the values are strings that represent the JSON value for that corresponding property. Any custom data that causes malformed JSON when the Object is persisted will not be included in the JSON output. For example, if a key from the custom data matches a property on the Object and both were written out to JSON, it would result in malformed JSON. So in this example, the key in the custom data causing the malformed JSON would not be persisted.





Link copied to clipboard
abstract fun toJson(): String

Convert an object to JSON string.