Closed eraychumak closed 1 year ago
yyjson does not preserve the original JSON data, so you can't access the raw JSON payload through col->uni.str
.
The content of yyjson_val_uni
is determined by the type of yyjson_val
. For example, col
is an array, then col->uni.ofs
stores the offset from this array to the next value. You can find more explanations here: https://github.com/ibireme/yyjson/blob/master/doc/DataStructure.md
If you want to print col
, you can do this:
const char *str = yyjson_val_write(col, 0, NULL);
// print str
if (str) free(str);
Ah, thanks for the insight!
I've went through the documentation numerous times and hit a bit of a roadblock; just to point out, my experience with C++ is still very new so I might be overseeing something entirely, however, I hope to get some support here.
I am trying to get the raw JSON payload as a string of a particular object, however, it keeps saying:
0x0000000000000330 <Error reading characters of string.>
The
col
variable is defined as so:Here's what I've tried so far:
If anyone can guide me with this issue, it would be much appreciated! 😁
Also, if more information is needed, please do ask.