Allow proper serialization using JSON.generate