Build Status GitHub (pre-)release Maven Central GitHub license Quality Gate Status Jetbrains plugin

Make a full json content assertion using the minimum amount of code using an expected JSON content with the possibility to add custom field validation.

Make your tests light, easy to write, readable and exhaustive.

This tool is based on the very useful JSONassert one and add the embedded validation system to assert unpredicatable values.

Examples

The actual JSON you want to validate :

{
    "field_1": "some value",
    "field_2": "3716a0cf-850e-46c3-bd97-ac1f34437c43",
    "date": "2011-12-03T10:15:30Z",
    "other_fields": [{
        "id": "2",
        "link": "https://another.url.com/my-base-path/query?param1=true"
    }, {
        "id": "1",
        "link": "https://some.url.com"
    }]
}

The expected JSON with embedded validation :

{
   "field_1": "some value",
   "field_2": "{#uuid#}",
   "date": "{#date_time_format:iso_instant#}",
   "other_fields": [{
       "id": "1",
       "link": "{#url#}"
   }, {
       "id": "2",
       "link": "{#url_ending:query?param1=true#}"
   }]
}

More examples available here : ekino/jcv-examples

Try it online!

You can try it online here : Try JCV online

Best experience on IntelliJ IDEA®

You can get the JCV Assistant plugin available on IntelliJ Platforms: Jetbrains plugin

Validator documentation screenshot Auto completion screencast