I’m having some trouble reading information out of a preferences file. There is a preference entry that looks to me like an array:
{
"IgnoredVolumes": [
"Preboot",
"VM",
"Update",
"home"
]
}
I can read this into my application using Preferences.Load() (I’m using the ModernPreferences module BTW) but then I can’t seem to get to the item.
- VarType(Preferences.Get(“IgnoredVolumes”)) returns a 9 (“object”)
- If I try to read in the array I get TypeMismatchException. Code is:
var volString As String = String.FromArray(Preferences.Get(“IgnoredVolumes”)) - If I try to read it into a JSONNode I get a TypeMismatchException. Code here is:
var myVolumes As JSONNode
myVolumes = new JSONNode(“IgnoredVolumes”, Preferences.Get(“IgnoredVolumes”).StringValue)
I’ve used ModernPreferences a lot in recent years and it’s generally pretty good. But I’ve only used it to store individual items, not arrays. So it looks like I’m failing to read the array from the preferences file, and I can’t think why.
Can anyone point me to what I’m doing wrong?
Ian.
–