0

I have base64 string eyJod2liOmZhbHNlfV19 I use jsoncons lib. I want decode this string to json oblect. How can I do this?

Orest
  • 43
  • 1
  • 7

1 Answers1

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