Open
Description
There is a bug if one tries to unpack an empty json. Example:
let mut packer = Packer::new();
let options = PackOptions::new();
let packed = packer.pack(&json!({}), &options).unwrap();
let mut unpacker = Unpacker::new();
let unpacked: Result<Value, UnpackerError> = unpacker.unpack(&packed);
will result in:
thread 'main' panicked at /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonm-0.2.0/src/unpacker.rs:162:39:
index out of bounds: the len is 0 but the index is 0
The value can be packed, and the output is:
Array [
Number(0),
]
Unfortunately, that packed value cannot be unpacked.
For the meantime, you'd need to check whether the pack value equals that above, then manually return json!({})
.