SetValue raises jeUnsupportedValue
SetValue, Add, Insert or Value = … raises jeUnsupportedValue (vbObjectError + 520)
when a Scripting.Dictionary, a Collection, a recordset or another object is passed.
Environment
All versions of WKL Office JSON.
Cause
Only values with a JSON form are accepted: String, the numeric types, Boolean, Date,
Null, Empty and Nothing (written as null), one-dimensional arrays of these, and JSON nodes or a JDoc
(Value = … of a value node takes no arrays and no nodes with children; those raise jeInvalidOperation there,
see Values and limits).
Foreign objects, including Scripting.Dictionary and Collection, and arrays with more than one dimension have no
defined JSON form.
Resolution
- Build the structure with the library's own methods:
AddElementfor an object,AddArrayfor an array,SetValuefor each member. Convert a dictionary in a loop:
Dim target As JElement, key As Variant If doc.Root Is Nothing Then Set doc.Root = doc.CreateElement ' a new JDoc is empty Set target = doc.Root For Each key In dict.Keys target.SetValue CStr(key), dict(key) Next- Convert a two-dimensional array (for example from
GetRows) row by row into objects of an array.
en/wiki/msaccess/json/troubleshooting/unsupported-value.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille