in src/Utility/TypeExtensions.cs [116:145]
public static object ConvertFromJson(string json, bool returnCaseInsensitiveHashtable = false)
{
object retObj = JsonObject.ConvertFromJson(json, returnHashtable: true, error: out _);
if (retObj is PSObject psObj)
{
retObj = psObj.BaseObject;
}
// By default, the PowerShell language worker no longer tries to create a case-insensitive Hashtable from the output of ConvertFromJson.
// This is a breaking change which is tracked by https://github.com/Azure/azure-functions-powershell-worker/issues/909.
if (returnCaseInsensitiveHashtable && (retObj is Hashtable hashtable))
{
// In order to call into the DurableClient properties without having to worry about casing,
// we need to return a case-insensitive Hashtable for the DurableClient code path.
try
{
// ConvertFromJson returns case-sensitive Ordered Hashtable by design -- JSON may contain keys that only differ in case.
// We try to convert the Ordered Hashtable to a case-insensitive Hashtable, but if that fails, we keep using the original one.
retObj = new Hashtable(hashtable, StringComparer.OrdinalIgnoreCase);
}
catch
{
retObj = hashtable;
}
}
return retObj;
}