#include <iostream>
#include <fstream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace std;
int main() {
string filename;
// دریافت نام فایل از کاربر
cout << "Enter the JSON file name: ";
cin >> filename;
// خواندن فایل JSON
ifstream inputFile(filename);
// بررسی اینکه فایل به درستی باز شده باشد
if (!inputFile.is_open()) {
cout << "Could not open the file!" << endl;
return 1;
}
// تبدیل محتوای فایل به شیء JSON
json jsonData;
inputFile >> jsonData;
// نمایش محتویات JSON
cout << "Content of the JSON file:" << endl;
cout << jsonData.dump(4) << endl; // با فاصله ۴ چاپ میشود (قابل تنظیم)
return 0;
}