Add common json validation method.