I have a json object
{
"userId":1,
"birthDateTime":"1999-08-26T01:38:42Z",
"propNameN":null
}
I want to convert non nullable props to query params
var sb = new StringBuilder();
foreach (var c in json.Children().Cast<JProperty>())
{
if (!string.IsNullOrWhiteSpace(c.Value.ToString()))
{
//birthDateTime here has already changed format => {08/26/1999 01:38:42}
sb.Append($"&{c.Name}={HttpUtility.UrlEncode(c.Value.ToString())}");
}
}
at the moment result is
userId=1&birthDateTime=08%2f26%2f1999+01%3a38%3a42
but is should be
userId=1&birthDateTime=1999-08-26T01%3a38%3a42Z