Produce valid JSON when using nested JSON blocks - #20
Conversation
|
Just to follow up. I tried the current import json
import tempfile
config_fixed = '{"$0":"./main", "in_wcsim":{"first_event":"0" } }'
jconfig = json.loads(config_fixed)
print(jconfig)
config_wrong = '{"$0":"./main" ,"in_wcsim":"{"first_event":"0" }" }'
jconfig = json.loads(config_wrong)
print(jconfig)Python throws this on The issue is that the nested JSON block (i.e. the value of |
…Core into feature/nested_json
|
In order to make the review of this easier, here's a little script #include "Store.h"
#include <iostream>
#include <string>
int main() {
//Setup a store & fill it
ToolFramework::Store s1;
s1.Set("int", 1);
s1.Set("float", 134.1);
//Nest s1 inside s2
ToolFramework::Store s2;
std::string s1_str = "";
s1 >> s1_str;
s2.Set("store", s1_str);
s2.Print();
//Save s2 into a string
std::string s2_str = "";
s2 >> s2_str;
std::cout << s2_str << std::endl;
//Use this s2 string to create s3
ToolFramework::Store s3;
s3.JsonParser(s2_str);
s3.Print();
//save s3 into a string
std::string s3_str = "";
s3 >> s3_str;
std::cout << s3_str << std::endl;
}If you save it as g++ -std=c++14 test_store.cxx -o test_store -I include/ -L lib/ -lStore && ./test_storeThen, with this PR as of submission day, we have
With this PR + a merge of main today
With the main branch as of September 18th (6f76253)
With the main branch as of today (e1a1352) Better than before, but the only way to produce a valid JSON string is by exporting the Store to a JSON string, then parsing it with a different Store... TLDR; there is still a bug in |
…Core into feature/nested_json
|
Just to flag that this is still an issue. I've just tried with current Current The issue is on line 2 - the nested store is wrapped in extra quotes (i.e. This PR Produces valid JSON always when using Is there anything else I can do to show you that this is a real bug & the fix works? This bug is complicating TriggerApp work on HK, so we are eager for a fix |
|
fixed in another PR with a different method |
Also a prettyication change of
instead of
I'm sorry, but the comma was definitely in the wrong place!!
Closes #19