Skip to content
Discussion options

You must be logged in to vote

You can pass an iterator range:

#include <iostream>
#include "json.hpp"

using json = nlohmann::json;

int main()
{
    std::vector<std::uint8_t> resp = {'f', 'o', 'o', '{', '"', 'V', 'a', 'r', '"', ':', '1', '0', '}'};
    json j = json::parse(resp.begin() + 3, resp.end());
    std::cout << j << std::endl;
}

Output:

{"Var":10}

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@nlohmann
Comment options

@NicolaBlasuttigh
Comment options

@nlohmann
Comment options

@NicolaBlasuttigh
Comment options

@nlohmann
Comment options

Answer selected by NicolaBlasuttigh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants