I have base64 string eyJod2liOmZhbHNlfV19 I use jsoncons lib. I want decode this string to json oblect. How can I do this?
Asked
Active
Viewed 159 times
0
-
Step 1: decode base64. Step 2: decode JSON. – user253751 Jun 25 '20 at 13:42
1 Answers
0
#include <jsoncons/json.hpp>
using namespace jsoncons;
int main()
{
std::string input = "eyJod2liOmZhbHNlfV19";
std::string buffer;
jsoncons::decode_base64(input.begin(), input.end(), buffer);
std::cout << buffer << "\n\n";
try
{
auto j = json::parse(buffer);
}
catch (const std::exception& e)
{
std::cout << e.what() << "\n";
}
}

Orest
- 43
- 1
- 7