refactor helper read_json