diff --git a/src/cbor/encoder.cr b/src/cbor/encoder.cr index 65e5e63..92678b4 100644 --- a/src/cbor/encoder.cr +++ b/src/cbor/encoder.cr @@ -1,3 +1,5 @@ +require "json" + class CBOR::Encoder def self.new(io : IO = IO::Memory.new) packer = new(io) @@ -8,6 +10,10 @@ class CBOR::Encoder def initialize(@io : IO = IO::Memory.new) end + def write(j : JSON::Any) + write j.raw + end + def write(value : Nil | Nil.class, use_undefined : Bool = false) write(use_undefined ? SimpleValue::Undefined : SimpleValue::Null) end