Add toJSON to object