If you can look into documentation of jsoncpp Value class (I assume rootL1
is of this type, and operator[]
returns the same type), you will see that there is no unsigned char*
conversion constructor which would accept your userInfo->hashCred
array. There is one constructor which accepts const char*
but there is no implicit conversion from unsigned char*
to const char*
, the closest one is implicit conversion of pointer to bool which is choosen in your case.
The solution should be to use conversion constructor which accepts const char*
. You should think why you need unsigned char*
in the first place, maybe you can use an array of type char
? If you cant then you can try casting unsigned char*
to char*
:
rootL1["CurrentValue"] = reinterpret_cast<char *>(userInfo->hashCred)
but this can cause all sorts of problems depending on what you are actually storing in your array and also what jsoncpp is doing under the hood with this data.
I would suggest you treat your hashCred as binary data and uuencode it to char
array. Then store it in jsoncpp Value. For details look into here: Binary data JSONCPP
In jsoncpp test code you can also find some examples of how to store binary data as values.