Closed felipheggaliza closed 7 years ago
This format backend specifically reads and writes CBOR, not JSON. But you can use standard jackson-core
parser for reading/writing JSON.
When embedding "non-native" content, you will need to use two ObjectMappers
(or parsers/generators, if using streaming API). There is no automated support for embedding different formats within.
But I am not 100% sure I understand how you are thinking of handling this use case. I think the way to model things like this are:
public class ObjectInCBOR {
public int id; // and other fields
public byte[] payload; // encoded in some other format
and then you will need to first bind CBOR into this object; and then further decode/parse contents of payload
into another type.
Does this library supports the case when I use CBOT to encode/ decode JSON format with multiple data types?
For example:
Suppose this JSON message below was encoded using CBOR on the server side:
{error_cause: "device not found", success: true, }
Does jackson-dataformats-binary supports decoding it correctly?
I am asking that because I have used another Java CBOR library, and I got something like this:
{error_cause: device not found , success: SOME_ABSTRACT_TYPE }
Problems: error_cause does not have quotation marks, and sucess did not arrive with a boolean value.
Can someone help me with this?