Home > database >  Decimal conversion problem in Azure Functions
Decimal conversion problem in Azure Functions

Time:08-28

I have an Azure function that fetches decimal values (from api) and deserializes them (they have "." as decimal separator). When the function is executed locally the decimals are converted correctly, when instead it is executed by azure the decimals are not converted correctly and I find huge numbers. What can this be due to? I thought it could be related to the setting of the decimal separator, or related to the current culture. I would need help solving this problem. Thanks

CodePudding user response:

Try setting the current thread culture using this method: stackoverflow.com/a/7536117/396005

      culture = CultureInfo.CreateSpecificCulture("en-US");
      Thread.CurrentThread.CurrentCulture = culture;
      Thread.CurrentThread.CurrentUICulture = culture;
  • Related