Menu

how to use GDom::WriteJsonCpp results

Help
Anonymous
2013-10-08
2013-10-09
  • Anonymous

    Anonymous - 2013-10-08

    Fairly new to Waffles...

    Has anyone ever successfully written a model to c++ using GDom::WriteJsonCpp then done something with the resulting string? Writing the string and compiling it in my code is no problem, but I can't figure out how to create a model from it. I want to do something like this:

    string cppString = the string generated from GDom::WriteJsonCpp
    GDom doc = new GDom;
    GDomNode
    node = doc->newString(cppString.c_str());
    GRand rand(0);
    GLearnerLoader ll(rand);
    GDecisionTree *model = new GDecisionTree(node, ll);

    This doesn't work. Any help is appreciated.

     
  • Mike Gashler

    Mike Gashler - 2013-10-08

    I think you need to call parseJson, like this:

    string cppString = the string generated from GDom::WriteJsonCpp
    GDom doc;
    doc.parseJson(cppString.c_str(), cppString.length());
    GDomNode* node = doc.root();
    GRand rand(0);
    GLearnerLeader ll(rand);
    GDecisionTree* model = new GDecisionTree(node, ll);
    
     
  • Anonymous

    Anonymous - 2013-10-09

    Perfect! Thanks Mike.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.