Converting a CString to a rapidjson object

562 Views Asked by At

I have the CString

CString strMessage = "{ \n   \"text\":\"This is my message\" \n  }"

I was hoping to add that to an existing RapidJson document but as an object. Is there a way to convert the string to an object with out parsing out the data?

rapidjson::GenericValue<rapidjsonUTF> value;
value.Set(strMessage, document.GetAllocator());

But that says no matching overloaded function

EDIT

I figured out a way to do what I was looking for. Convert the string into a document and then add it as a member to another existing doc.

    CString secondJsonString = _T("{ \n   \"text\":\"This is my message\" \n  }");
    GenericDocument < rapidjsonUTF> doc2;
    doc.Parse<0>(jsonString);
    doc2.Parse<0>(secondJsonString);
    doc.AddMember(_T("doc2"), doc2, doc.GetAllocator());
0

There are 0 best solutions below