Use toData() with kotlinx.serialization instead.
toData(fields)
Convert this state to a JSON-serializable object.