Skip to content

jsoncons::semantic_tag::uri incorrectly encoded #238

@lrosenthol

Description

@lrosenthol

The following code:

        std::vector<uint8_t> odata;
        jsoncons::ojson oj(jsoncons::json_object_arg);
        oj.insert_or_assign("timestamp", jsoncons::ojson("05-12-2020", jsoncons::semantic_tag::datetime) );
        oj.insert_or_assign("URL", jsoncons::ojson("http://www.domain.com", jsoncons::semantic_tag::uri) );
        jsoncons::cbor::encode_cbor(oj, odata);
        jsoncons::ojson oj2 = jsoncons::cbor::decode_cbor<jsoncons::ojson>(odata);
        std::cout << "(oj)\n" << pretty_print(oj2) << "\n\n";

produces the following (incorrect) output:

(oj)
{
    "timestamp": "05-12-2020", 
    "URL": -1
}

I have also verified that the encoder is the problem by taking the binary output and putting it into (http://cbor.me) and receiving the same -1 result.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions