Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request, Add to_json/from_json to align with other to/from binary api. #3067

Closed
lygstate opened this issue Oct 9, 2021 · 0 comments

Comments

@lygstate
Copy link

lygstate commented Oct 9, 2021

I wanna do something like this:

    switch (serialize_type) {
    case PreonCapiSerializeJSON:
        j = nlohmann::json::parse(json_data, json_data + json_size);
        break;
    case PreonCapiSerializeCBOR:
        j = nlohmann::json::from_cbor(json_data, json_data + json_size);
        break;
    case PreonCapiSerializeMessagePack:
        j = nlohmann::json::from_msgpack(json_data, json_data + json_size);
        break;
    case PreonCapiSerializeUBJSON:
        j = nlohmann::json::from_ubjson(json_data, json_data + json_size);
        break;
    case PreonCapiSerializeBSON:
        j = nlohmann::json::from_bson(json_data, json_data + json_size);
        break;
    default:
        return -101;
    }

But the json API stops me doing that.

@nlohmann nlohmann removed the kind: bug label Oct 9, 2021
Repository owner locked and limited conversation to collaborators Oct 9, 2021
@nlohmann nlohmann closed this as completed Oct 9, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants