VisualJsonEditor icon indicating copy to clipboard operation
VisualJsonEditor copied to clipboard

"Error converting value "True" to type 'System.Collections.Generic.ICollection`1[System.String]"

Open ChrisLynchHPE opened this issue 9 years ago • 8 comments

I'm getting the following error when I attempt to load my JSON file with what I believe is a valid JSON Schema:

Error converting value "True" to type 'System.Collections.Generic.ICollection`1[System.String]'. Path 'properties.Name.required', line 5, position 22.

I have attached the JSON Schema file, and a sample JSON file that contains the data for your reference.

My system is a Windows 10 PC (Insider Fast Ring, 14376) and v1.4.5944.34935 of your Visual JSON Editor.

HPOneView.300_CmdletHelp.json.txt Test.json.txt

ChrisLynchHPE avatar Jul 01 '16 20:07 ChrisLynchHPE

I think this is not a draft v4 schema...

RicoSuter avatar Jul 01 '16 22:07 RicoSuter

Try removing all required attributes.. in draft v4 required contains a list of the required properties..

RicoSuter avatar Jul 01 '16 22:07 RicoSuter

Not sure I completely understand. Are you suggesting that I remove the "required" property/attribute in the schema file I manually created?

ChrisLynchHPE avatar Jul 16 '16 04:07 ChrisLynchHPE

Okay, so I did a bit more research, and I believe I created a JSON v4 Schema. I usedhttp://jsonschema.net/#/ to create the schema. Here is the updated schema: HPOneView.300_CmdletHelp.json.txt

ChrisLynchHPE avatar Jul 16 '16 04:07 ChrisLynchHPE

And when I use the schema file, I now get a different error:

Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'.

ChrisLynchHPE avatar Jul 16 '16 04:07 ChrisLynchHPE

The property items is used to describe a tuple type (I.e. it must be an array of schemas. I think in your case you need the item property which describes the array item type...

RicoSuter avatar Jul 18 '16 23:07 RicoSuter

I used http://jsonschema.net/#/ to create the JSON v4 Schema file. The JSON object is quite simple. It is an Array of an Object that is very specific. The Object contains a String attribute called Name, then an Object called Contents. Contents contains nested objects and arrays.

Is there any way to debug your tool to find out where exactly it is generating the error?

ChrisLynchHPE avatar Jul 19 '16 03:07 ChrisLynchHPE

You can clone or download the source code and run it with debugger attached.. can you provide a sample json and json schema v4?

RicoSuter avatar Jul 28 '16 18:07 RicoSuter