move checkJson variable to require scope