Define custom validator for json fields