| 137 | |
| 138 | |
| 139 | void AnalyzeFile(char *fname) { |
| 140 | g_Config.hide_full_output = 1; |
| 141 | g_Config.debug = 1; |
| 142 | std::string filename = std::string(fname); |
| 143 | LOG_A(LOG_INFO, "Analyzer: Reading %s", filename.c_str()); |
| 144 | std::string json_file_content = read_file(filename); |
| 145 | if (json_file_content.empty()) { |
| 146 | LOG_A(LOG_ERROR, "Could not read file"); |
| 147 | return; // Exit if the file could not be read |
| 148 | } |
| 149 | |
| 150 | nlohmann::json json_data; |
| 151 | try { |
| 152 | json_data = nlohmann::json::parse(json_file_content); |
| 153 | } |
| 154 | catch (const std::exception& e) { |
| 155 | std::cerr << "Failed to parse JSON: " << e.what() << std::endl; |
| 156 | return; |
| 157 | } |
| 158 | if (!json_data.is_array()) { |
| 159 | std::cerr << "JSON data is not an array." << std::endl; |
| 160 | return; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | |
| 165 | |