toJSON function added