-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
Given that the JSON.json properly prints the serialized string, shouldn't the file creation just work? What am I missing?
julia> x = Dict{String,Dict{String,Float64}}("a" => Dict("a1" => 1))
Dict{String, Dict{String, Float64}} with 1 entry:
"a" => Dict("a1"=>1.0)
julia> JSON.json(x)
"{\"a\":{\"a1\":1.0}}"
julia> JSON.json("test.dat", x)
ERROR: MethodError: no method matching JSON.Writer.PrettyContext(::IOBuffer, ::Dict{String, Dict{String, Float64}}, ::Int64, ::Bool, ::Set{UInt64}, ::Nothing)
The type `JSON.Writer.PrettyContext` exists, but no method is defined for this combination of argument types when trying to construct it.
Closest candidates are:
JSON.Writer.PrettyContext(::T, ::Int64, ::Int64, ::Bool, ::Set{UInt64}, ::Any) where T<:IO
@ JSON ~/.julia/packages/JSON/93Ea8/src/Writer.jl:102
JSON.Writer.PrettyContext(::IO, ::Any, ::Any)
@ JSON ~/.julia/packages/JSON/93Ea8/src/Writer.jl:109
JSON.Writer.PrettyContext(::IO, ::Any)
@ JSON ~/.julia/packages/JSON/93Ea8/src/Writer.jl:109
```
It appears that this should work from the docs here: https://juliaio.github.io/JSON.jl/stable/writing/#Core-JSON-Serialization-JSON.jsonMetadata
Metadata
Assignees
Labels
No labels