add toJSON method