Hello,
After upgrading from Windows 11 23H2 to Windows 11 24H2, we encounter an issue by executing the following script :
Dim jsonString
jsonString = "{""name"":""John"", ""age"":30, ""city"":""New York"", ""array"":[{""name"":""toto""},{""name"":""titi""}]}"
Dim sc
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "JavaScript"
' Define JS function to parse the json
sc.AddCode "function parseJSON(json) { return eval('(' + json + ')'); }"
' call the function to parse JSON
Dim jsonObject
Set jsonObject = sc.Run("parseJSON", jsonString)
' Accéder aux données du JSON
WScript.Echo "Type: " & TypeName(jsonObject)
WScript.Echo "Object: " & jsonObject
WScript.Echo "Name: " & jsonObject.name
WScript.Echo "Age: " & jsonObject.age
WScript.Echo "City: " & jsonObject.city
For Each elt In jsonObject.array
WScript.Echo "Array elt: " & elt.name
Next
' Clean
Set sc = Nothing
Everything works correctly except the following:
For Each elt In jsonObject.array
WScript.Echo "Array elt: " & elt.name
Next
it used to work in 23H2 and it does not work anymore.
This seems to be explained in this thread:
https://admx.help/?Category=Windows_11_2022&Policy=Microsoft.Policies.InternetExplorer::JScriptReplacement
if you set the parameter to disable, you load jscript.dll instead of the legacy dll.
How does it come the legacy dll is the default ?
this is a breaking change for all our customers and we need a fix from Microsoft that will not accept to change the regedit.