From this line down to the end of this function should be put into a separate function that takes the json we get back from the validator. Reason I'm asking for this is so we can test that function performs as expected by writing a couple of tests with some mock json data. In theory we could also validate the json that's coming back with a json schema too.