I am reading some information and I want to write it in json, but the names of some keys contain dots in the name. I want to get something like this:
{
"programs":
{
"tmp.exe" : "D:\\Directory\\Directory",
"foo.exe" : "C:\\Directory"
}
}
This is my code:
ptree pt;
ptree name;
name.put(string_name,string_directory);
pt.add_child("programs",name);
But it turns out the following:
{
"programs":
{
"tmp":
{
"exe" : "D:\\Directory\\Directory"
},
"foo":
{
"exe" : "C:\\Directory"
}
}
}
I was thinking about adding it as a child. But this code does not work at all
ptree pt;
ptree name;
name.put("",string_name);
pt.add_child("programs",name);
pt.find(string_name).put_value(string_directory);