Closed waghanza closed 8 years ago
array_of_hash.to_msgpack
?
or by hands
[1, {1 => 2}]
packer.write_array_start(2)
packer.write(1)
packer.write_hash_start(1)
packer.write(1)
packer.write(2)
I think the JSON::Any is throwing the error
And the slice
@kostya seems not to work since I have to overloead matches
@benoist new to crystal
and compiled language, could you explain plz
Welcome to crystal :-). The array of hashes has got values of type JSON::Any and Slice(UInt8) which msgpack does not know how to convert. You can see the type of array_of_hashes by calling .class on it. It should fit the MessagePack::Type.
@benoist type is Array(Hash(String, Nil | String | Float32 | Float64 | Time | JSON::Any | Bool | Int32 | Int64 | Int16 | Slice(UInt8)))
array_of_hashes contain array of hash (String,String)
but type overload seem not te be available
Yes that's what I thought. There are two types that can't be MessagePacked. So either remove them from the hash or convert them to a supported type in the MessagePack::Type alias
@benoist and what message pack could convert ? String an Int ?
MessagePack::Type = Nil | Bool | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 | Float32 | Float64 | String | Array(Type) | Hash(Type, Type)
Did you manage to do what you wanted?
no, I have temporarily left msgpack (I' use json as my app is unstable)
Hello,
I want to write in a
MessagePack::Packer.new
a bunch of hashes to do this I usebut I have this error
However
is not yet supported by
crystal
DO you know when this will be available ?
Regards,