You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to parse JSON of the following format,
json_ParseKey branch and I get Err.Raise 10001.
I want to solve the problem of processing an array as a key, since it is not a wrong JSON format.
Can you help me?
Function test()
Dim target As String
target = "[ {'List': [ '11111' ] } ]"
Dim json As Dictionary
Set json = JsonConverter.ParseJson(target)
End Function
The text was updated successfully, but these errors were encountered:
You need to reread the project readme as well as Microsoft's website on the VBA.Collection and Scripting.Dictionary objects. VBA-JSON maps a Javascript Array to a VBA.Collection and a Javascript Object to a Scripting.Dictionary.
Your sample Javascript document is a Javascript Array, but you declared the variable to hold the return value as a Scripting.Dictionary which is not the correct object that matches your Javascript document. Also, in VBA you need to use the Set command to set the value of an object. See also, Microsoft VBA Reference on their website.
Andrew, are you having issues with your chatbot? ;} Javascript is not relevant here.
Syakado, the text string you provided does not give an error 10001 (with version v2.3.2). It does give an error 13 (Type mismatch). After fixing Dim json As Object the function works as expected.
If you are getting error 10001 in json_ParseKey with a different text, then there is something wrong with a key:value pair; the error message text is more specific. Examples are:
{"key" value} - missing colon
{"key: value} - missing closing quote
{key: value} - only valid if you set JsonOptions.AllowUnquotedKeys
The ECMA standard specifies that a key is a string enclosed in double quotes. Unquoted single-word keys and keys using single quotes {'key': value} are VBA-JSON extensions. VBA-JSON does not support non-unique keys.
You cannot use a JSON Object or a JSON Array as a key, unless you encode it as a quoted string.
==========
If this solves your problem, please close the issue here.
Hello Guys.
Allow me to use a translation tool.
If you try to parse JSON of the following format,
json_ParseKey branch and I get Err.Raise 10001.
I want to solve the problem of processing an array as a key, since it is not a wrong JSON format.
Can you help me?
The text was updated successfully, but these errors were encountered: