IntControl(73,1,0,0,0)
Gosub udfs
AddExtender('ilcjs44i.dll', 0, 'ilcjs64i.dll')
JsonData = $"{
"version":: "1.0",
"dependencies":: {
"Microsoft.NETCore.UniversalWindowsPlatform":: "5.2.2",
"Microsoft.Toolkit.Uwp.Notifications":: "1.1.0",
"QueryString.NET":: "1.0.0"
},
"frameworks":: {
"uap10.0":: {}
},
"runtimes":: {
"win10-arm":: {},
"win10-arm-aot":: {},
"win10-x86":: {},
"win10-x86-aot":: {},
"win10-x64":: {},
"win10-x64-aot":: {}
}
}$"
If ! jsValid(JsonData) Then Terminate(@TRUE,"Cannot Continue","Invalid Json")
jsHandle = jsParse(JsonData)
;; This can still error if the key contains path information and
;; it is syntactically malformed.
;try these
;cKey = "version" ;should return 1.0
;cKey = "runtimes" ;should return Json Object
;cKey = "QueryString.NET"
cKey = "uap10.0"
result = jsKeyExist(jsHandle,cKey)
If result == 0 Then Message(cKey,"Does Not Exist")
If result >1 && result <=8
Message(cKey,jsValueGet(jsHandle,cKey))
Endif
If result == 16
path = jsKeyPaths(jsHandle,cKey)
values = ''
jsArray = jsValueGet(jshandle, path[0])
paths = jsKeyPaths(jsArray, '')
foreach elem in paths
values := jsValueGet(jsArray, elem):','
next
Message(cKey,values)
Endif
If result == 32 Then Message(cKey,"is a Json Object")
If result == 64 Then Message(cKey,"key exists but value cannot be determined")
jsConClose(jsHandle)
exit
:udfs
#definesubroutine jsKeyExist(_handle,_Key)
IntControl(73,1,0,0,0)
retval = Arrinfo(jsKeyPaths(_handle, _key), 1)
If retval > 0 Then retval = jsValueType(_handle, _key)
return retval
:WBERRORHANDLER
IntControl(73,1,0,0,0)
return 64
Exit
#endsubroutine
#DefineSubRoutine geterror()
wberroradditionalinfo = wberrorarray[6]
lasterr = wberrorarray[0]
handlerline = wberrorarray[1]
textstring = wberrorarray[5]
linenumber = wberrorarray[8]
errmsg = "Error: ":lasterr:@LF:textstring:@LF:"Line (":linenumber:")":@LF:wberroradditionalinfo
Return(errmsg)
#EndSubRoutine
Return