+ Start a Discussion

JSON Schema validation in APEX

I wonder if there is in APEX a way to validate a JSON string against a defined json schema ?
Somthing like  :
If(isValid(jsonString, jsonSchema)) {
Basically, we are unable to make callouts to a third party system because they want us to validate our JSON payload with a schema before sending as part of their quality requirements.

Link to the schema  : 
Ashish DevAshish Dev
I think your best bet would be to create json serialize it, and then deserialize it agains your custom schema ApexType.

I am using this techniqueue across all rest callout , you can use the same. 

public boolean isValid(String JsoneString){
    jsonSchema jsonObj=new jsonSchema();
        return true;
    }catch(Exception e){
        return false;
public class jsonSchema{
    String Name;
    String Age;