how to use GDom::WriteJsonCpp results

Help
Anonymous
2013-10-08
2013-10-09
  • 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 - 2013-10-09

    Perfect! Thanks Mike.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks