Skip to main content

CBOR: Decode Node

The CBOR: Decode Node allows a workflow to decode a CBOR (Concise Binary Object Representation) string on the payload, and store that result on the payload for later use.

CBOR: Decode Node

Node Properties

The CBOR: Decode Node's configuration is broken up into three sections ...

Input

  • Input Encoding: The encoding method applied to the data you wish to decode. Options are:
    • Base64
    • Binary
    • Hex (default)
  • Encoded String Path: The payload path to the string to decode.

Result

  • Decoded Result Path: The payload path at which to store the result.

Errors

Read more about handling errors from this node below.

Node Example

Given the following payload ...

{
"data": "a26568656c6c6f65776f726c6466706c65617365a366656e636f6465626d656261738461436142614f61526574696d657301"
}

... and a CBOR: Decode Node with the following configuration ...

  • Input Encoding: Hex
  • Encoded String Path: data
  • Decoded Result Path: working.parsedCborData

The payload after execution of the CBOR: Decode Node would look like:

{
"data": "a26568656c6c6f65776f726c6466706c65617365a366656e636f6465626d656261738461436142614f61526574696d657301",
"working": {
"parsedCborData": {
"hello": "world",
"please": {
"encode": "me",
"as": ["C","B","O","R"],
"times": 1
}
}
}
}

Use Case

The CBOR: Decode Node is commonly used in conjunction with the CBOR: Encode Node as a means of reducing bandwidth usage by an Edge Compute device. See the CBOR: Encode Node use case for a detailed example.

Node Errors

In the case that the value found at the Encoded String Path fails to parse, no value will be placed at the Decoded Result Path; however, an object detailing the error will be placed at the Error Path if a path is provided.

Below is an example of an error stored on the payload at the path working.cborError:

{
"working": {
"cborError": {
"message": "The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object",
"type": "CBOR_DECODE_NODE_ERROR"
}
}
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.