How to validate the JSON response with expected JSON schema

OK, I was not aware how the JSON Schema spec draft04 denotes. But I seem to remember that I have ever encountered some cases where “string” type seemed to mean “anything” — just as @Rams_Palani saw. I would guess that the Everit JSON Schema validator might be a bit buggy. Of course we need to verify it.

i was using everit with exact same scenario, changing from number to string will fail. i have the feeling the OP schema is not complete or does not have the right structure … in some cases, if the schema is not matching with the response (but is a valid json) will just pass everything. e.g use an empty object:

{}

this schema is valid. will pass all

LE: i allways avoided to use refs in the schema. can create confusions, and is easy to do mistakes. i know, is convenient to use it when you have a nice swagger … but i tend to write schema’s from scratch …

LLE: from the pics posted i cannot see what is in the root field. there should be an exact sintax so everit can switch to draft04, 07 etc. if is nothing will default to 04. if is something else … not sure what will happend but it may treat is as empty schema

I got error like this : #: expected type: JSONObject, found: JSONObject

response.json :
{ "type": "array" }

response body :

{ "error":false, "message":"Successfully get categories.", "data":[ 8151, 8234 ], "length":71, "unfiltered_length":71, "pagination":{ "more":false } }