Closed cfauchere closed 3 years ago
As the API documentation says, .ToString()
for this type returns the JSON encoding of the value. It is equivalent to .ToJsonString()
. If you want the string value as a string, use AsString
which is specifically for that purpose.
The rationale for ToString()
behaving differently from AsString()
is that it is common to use ToString()
in debugging/logging where you simply want a quick way to see a printable representation of the value— and LdValue
is, by definition, a JSON value that can be of any JSON type, so it is desirable to be able to distinguish the numeric value 123
from the string "123"
as those are not the same thing in JSON. And, in the context of the LaunchDarkly SDKs where this type is used, that is an important distinction— the variation values of a feature flag could be numbers, strings, booleans, etc. and those can't be used interchangeably.
Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here and clicking "submit a request", or by emailing support@launchdarkly.com.
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
Describe the bug With string values calling LdValue.ToString() wraps the string with double quotes.
To reproduce Steps to reproduce the behavior.
Expected behavior Expected behavior: ToString() does not wrap the string but return the string itself (like AsString does)
SDK version
Language version, developer tools C# .Net5
OS/platform Widnows 10