See the question and my original answer on StackOverflow

The problem was explained in the comments. As for the solution, because you're using std (there are plenty other solutions), I suggest you use the widen function defined in this answer on SO: Is this code safe using wstring with MultiByteToWideChar? and change the code to:

CComVariant result = widen(json).c_str();

Let's check under the debugger. Before:

enter image description here

After:

enter image description here

Now, the VARIANT (or it's contained BSTR) is fine.

Note if you need a byte string equivalent from this VARIANT or from a BSTR (do you really?), don't convert it back with a broken code like this: std::string(CStringA(varJson)), again, use a reverse equivalent of widen, based on WideCharToMultiByte this time.