Testing this:
var s = "{\"dyn_10\":[\"Lawn care\"]}";
var jsonObject = JsonObject.Parse(s);
foreach (var entry in jsonObject)
{
var x = entry.Value;
}
x == [Lawn care] rather than [“Lawn care”]
…so it has lost the quotes which causes problem for me immediate after.
Note that above is a simplified example real code is more like:
var dictionary = new Dictionary<string, StringValues>();
if (updateJobReq.Questions != null) // If it is null then no dynamic questions were answered at all
{
//var s = WebUtility.HtmlDecode(updateJobReq.Questions);
var s = "{\"dyn_10\":[\"Lawn care\"],\"dyn_13\":\"Less than 30 sqm\",\"dyn_12\":\"No\",\"dyn_11\":\"Tall grass (needs slashing)\"}";
var jsonObject = JsonObject.Parse(s);
foreach (var entry in jsonObject)
{
Console.WriteLine(entry.Value);
var parsedVals = entry.Value.IsJson() ? entry.Value.FromJson<string[]>() : new[] { entry.Value };
if (parsedVals.Length < 1)
continue;
dictionary.Add(entry.Key, new StringValues(parsedVals));
}
}