Closed
Description
Is this intentional? Values of a dict are unpacked before serialization, but keys are not:
using JSON3, StructTypes
struct IntWrapper
val::Int
end
StructTypes.StructType(::Type{IntWrapper}) = StructTypes.NumberType()
StructTypes.numbertype(::Type{IntWrapper}) = Int
Base.Int(id::IntWrapper) = id.val
JSON3.write(IntWrapper(42)) == "42" # true
JSON3.write(Dict(IntWrapper(42) => 42)) == "{\"42\":42}" # false
JSON3.write(Dict(42 => IntWrapper(42))) == "{\"42\":42}" # true
Am I missing something or is this a bug?
Metadata
Metadata
Assignees
Labels
No labels