Convert CBOR from/to JSON string
This website is an online converter for CBOR (Concise Binary Object Representation) and JSON (JavaScript Object Notation). It allows you to encode and decode data in CBOR and JSON formats.
To get started, just paste your CBOR value (in base64 or hex) or a JSON string into the respective input field above.
CBOR (Concise Binary Object Representation) is a binary data format that aims to be smaller and more efficient than JSON. It provides a compact binary representation of structured data, making it useful for scenarios where size and performance are important.
For more information, you can visit the CBOR website.
When converting from JSON to CBOR, if a stringified Buffer object is detected in the JSON (e.g. "type":"Buffer","data":[1,2,3]), it will be automatically converted back to a Buffer in the CBOR output.
ArrayBufferLike values in CBOR cannot be directly stringified to JSON. To handle this, you can choose how to display buffer-like values when converting from CBOR to JSON using the "Buffer Format" dropdown:
Note that these display options only affect CBOR to JSON conversion. When converting from JSON to CBOR, buffer-like values need to be properly formatted as Buffer objects.
CBOR supports Set data structures, but these cannot be directly stringified to JSON. By default, Sets are automatically converted to Arrays when converting from CBOR to JSON.
You can toggle this behavior in the settings menu (gear icon) next to the Buffer Format selector. When disabled, Sets will be preserved as objects with their original type information.
Explore the GitHub repository to view the source code, contribute to pull requests and issues.
Visit my blog for more developer tips and stories.