use JSONWriter API for custom JSON marshaller