quinnj / JSON3.jl

Other
214 stars 47 forks source link

`parsequoted` doesn't work with keys #176

Open chris-b1 opened 3 years ago

chris-b1 commented 3 years ago

Reproducing example below - I think this should work?

julia> d = Dict(65 => 1.1, 66 => 1.2)
Dict{Int64, Float64} with 2 entries:
  65 => 1.1
  66 => 1.2

julia> d_str = JSON3.write(d)
"{\"65\":1.1,\"66\":1.2}"

julia> JSON3.read(d_str, Dict{Int64, Float64}; parsequoted=true)
ERROR: MethodError: no method matching Int64(::String)
Closest candidates are:
  (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
  (::Type{T})(::BigInt) where T<:Union{Int128, Int16, Int32, Int64, Int8} at gmp.jl:356
  (::Type{T})(::Base.TwicePrecision) where T<:Number at twiceprecision.jl:243
quinnj commented 3 years ago

Hmmmm, not really, since we don't support parsing object keys as anything but String or Symbol currently.