-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
Hi,
I still didn't figure out how to decode CBOR to primitive data types. Can you give me an example?
I have been trying this:
ByteArrayInputStream bais = new ByteArrayInputStream(data);
List<DataItem> dataItems = null;
try {
dataItems = new CborDecoder(bais).decode();
} catch (CborException e) {
e.printStackTrace();
}
JsonObject jsonResponseObject = null;
for (DataItem dataItem : dataItems) {
// process data item
Log.d(TAG, "Decoded CBOR: " + dataItem.toString());
Log.d(TAG, "Decoded CBOR: " + dataItem.getMajorType().toString());
}
Output:
Decoded CBOR: SIMPLE_VALUE
Decoded CBOR: MAP
I am expecting a boolean value instead of words: SIMPLE_VALUE or MAP. How can I fix it?