Reputation: 61
I am trying to validate my json schema in command line using the jsonschema python package and I get the error:
jsonschema: error: argument schema: invalid _json_file value
I don't understand the error as I have valid json file which I tested in myjson.com and tried with jsonview in Chrome.
Has any one had similar issues, and if so, what does this mean?!
{
"id": "http://test.com/models/reg.json"
"description": "schema for register",
"register": {
"type": "object",
"name": {"type": "string"},
"groups": {
"type": "object",
"primary": {"type": "string"},
"secondary": {
"type": "array",
}
},
"title": {"type": "string"},
"attribute": {"type": "string"},
"configuration": {"type": "string"}
}
}
Upvotes: 0
Views: 1606
Reputation: 82934
Attempting json.loads(your_input_string)
:
You have a missing comma after the .json"
right up the front.
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 3 column 1 (char 42)
Fixing that, we move along to
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 12 column 7 (char 280)
This happens in "secondary": {"type": "array", }
(whitespace compressed). That comma should not be there. Python allows it; JSON doesn't.
No further errors.
Note: Same results using myjson.com (except that myjson tells you only that you have an error, not what, not where). Suggested: use Python for error detection
Upvotes: 1