Reading a JSON file into ROOT C++

Hi Isidro,

TBufferJSON can only be used for C++ classes with dictionary.
And produced JSON code has special format, which not always can be mapped to arbitrary JSON file.
But for simple structures it also looks very simple. Here is simple example:

struct Example1 {
   std::string key1;
   std::string key2;
};

void json()
{
   Example1 ex1;
   ex1.key1 = "name1";
   ex1.key2 = "name2";

   TString str = TBufferJSON::ToJSON(&ex1);

   printf("JSON\n%s\n", str.Data());

   auto res = TBufferJSON::FromJSON<Example1>(str.Data());

   printf("Decode %s %s\n", res->key1.c_str(), res->key2.c_str());
}

JSON code for that structure have to be:

{
   "_typename" : "Example1",
    "key1": "name1", 
    "key2": "name2"
}

Internally ROOT uses nlohmann/json parser, but it will be made public only in next 6.24 release (current master branch). nlohmann/json parser can parse arbitrary JSON file, but I have my doubts if this highly templated C++ library can be used via PyROOT.
Probably, you can use json parser, available in python.

Regards,
Sergey