Handle json file reading properly