StructTypes.jl
StructTypes.jl copied to clipboard
`Real` does not deserialize
Julia Version: 1.7.2.
I see that Real is supposed to be StructTypes.NumberType(), but it can't actually deserialize:
julia> JSON3.read("456", Real)
ERROR: ArgumentError: invalid JSON at byte position 1 while parsing type Real: ExpectedOpeningObjectChar
456
julia> JSON3.read("456", Union{Integer, AbstractFloat})
456.0
Can you share what version of JSON3/StructTypes you have? I'm not seeing the same problem:
julia> using JSON3
julia> JSON3.read("456", Real)
456.0
StructTypes v1.8.1
JSON3 v1.9.2
Here's an exact printout of my session:
| | |_| | | | (_| | | Version 1.7.2 (2022-02-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
(Bplus) pkg> status StructTypes
Project Bplus v0.1.0
Status `C:\Users\manni\Documents\Code\B-plus\Project.toml`
[856f2bd8] StructTypes v1.8.1
(Bplus) pkg> status JSON3
Project Bplus v0.1.0
Status `C:\Users\manni\Documents\Code\B-plus\Project.toml`
[0f8b85d8] JSON3 v1.9.2
julia> using JSON3; JSON3.read("45", Real)
ERROR: ArgumentError: invalid JSON at byte position 1 while parsing type Real: ExpectedOpeningObjectChar
45