Add toJSON for supporting chronicling.