We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using JSON v0.20.0 on Julia Version 1.0.3 Code to reproduce:
x = NamedTuple() y = (a=1,b=2)
julia> typeof(x) NamedTuple{(),Tuple{}} julia> typeof(y) NamedTuple{(:a, :b),Tuple{Int64,Int64}}
Correctly serialize stuffed NamedTuple.
julia> JSON.json(y) "{\"a\":1,\"b\":2}"
Expecting empty NamedTuple serialized to an empty object.
julia> JSON.json(x) "{}"
But got this:
julia> JSON.json(x) ERROR: Cannot serialize type NamedTuple{(),Tuple{}} Stacktrace: [1] error(::String) at .\error.jl:33 [2] lower(::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:47 [3] show_json(::JSON.Writer.CompactContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::JSON.Serializations.StandardSerialization, ::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:314 [4] #show_json#3(::Nothing, ::Function, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::JSON.Serializations.StandardSerialization, ::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:325 [5] show_json(::Base.GenericIOBuffer{Array{UInt8,1}}, ::JSON.Serializations.StandardSerialization, ::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:324 [6] print(::Base.GenericIOBuffer{Array{UInt8,1}}, ::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:349 [7] #sprint#324(::Nothing, ::Int64, ::Function, ::Function, ::NamedTuple{(),Tuple{}}) at .\strings\io.jl:101 [8] sprint(::Function, ::NamedTuple{(),Tuple{}}) at .\strings\io.jl:97 [9] json(::NamedTuple{(),Tuple{}}) at .\.julia\packages\JSON\ebvl3\src\Writer.jl:354 [10] top-level scope at none:0
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I am using JSON v0.20.0 on Julia Version 1.0.3
Code to reproduce:
Correctly serialize stuffed NamedTuple.
Expecting empty NamedTuple serialized to an empty object.
But got this:
The text was updated successfully, but these errors were encountered: