I have a properly formatted JSON string message from which I generate a JSONItem with
jmsg.Load(message.data). That works mostly fine - I can extract ordinary key/value pairs with jmsg.Value("server_id"
) for instance.
My problem is what to do with a jmsg.Value which I know in advance is an array of strings like:
["X54", "JW382", "B52"]
(although I usually won’t know how many strings there will be).
I’ve tried
Var v As Variant
v = jmsg.Value("device")
If VarType(v) = Variant.TypeObject Then
//do something
There exists a test for Variant.TypeArray too but I’m not sure how to use it correctly. The documentation says something about logically ORing it with the vartype of the array element (string) but I don’t see how that can work when VarType(v) returns 9 (the Variant.TypeObject constant).
So, I’m left wondering how to access elements of v (which I know is an array) when v thinks it is an object. Is there some way to cast it from object to array of strings?
Thanks for any help,
chris