Could you pull out the map<string,string> -> json object logic?