RicoSuter / VisualJsonEditor

A JSON schema based file editor for Windows.
http://visualjsoneditor.org
MIT License
349 stars 87 forks source link

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

Open ChrisLynchHPE opened 8 years ago

ChrisLynchHPE commented 8 years ago

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

RicoSuter commented 8 years ago

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

RicoSuter commented 8 years ago

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

ChrisLynchHPE commented 8 years ago

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

ChrisLynchHPE commented 8 years ago

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 commented 8 years ago

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'.

RicoSuter commented 8 years ago

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...

ChrisLynchHPE commented 8 years ago

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?

RicoSuter commented 8 years ago

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