Losing a bit of lean muscle mass along the way is not important compared to the huge health gains of losing the weight.
When it comes to long term health outcomes, losing weight is the only thing that matters.
You need to be getting enough protein + strength training to maintain muscle in a caloric deficit
Regardless of how you lose weight the advice is and remains:
> Eat a minimum of 0.36 grams of protein per day, per pound of LEAN* body weight. Increasing to 0.5-0.7 grams of protein per day, per pound of LEAN* body weight for older adults or when undergoing weight loss.
*LEAN is a vital detail for overweight people, they commonly miscalculate protein requirements due to this. The easiest way for overweight people to determine their requirement, is just find an "ideal body weight calculator" online, enter height and gender, and then multiply THAT figure by 0.5-0.7.
For example a man who is 6' tall and 400 lbs should eat 62 grams of protein per day MINIMUM, but during weight loss 86-120 grams of protein per day. It is common, unfortunately, to read online people in this situation miscalculate this to 280(!) grams of protein per day which is incorrect and harms their weight-loss goals.
> Protein intake should range between 1.0-1.5 grams/kg of adjusted body weight. To calculate adjusted body weight, first calculate excess weight: Excess weight = current weight — ideal body weight (IBW). Adjusted body weight = IBW + 0.25 of excess body weight. This amount generally accounts for 20% to 30% of total caloric intake.
So a slightly more complex way of calculating roughly the same thing. I'd argue that for most people getting your ideal weight is a good enough approximation, and that using your overweight/obese body fat in your protein calculation is wrong by a lot no matter which calculation you use.
https://www.ajmc.com/view/chapter-2-clinical-nutrition-guide...