Add toJSON method