adding toJSON.function method