modified on_writeJSON api