Skip to content
New issue

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

Real does not deserialize #95

Open
heyx3 opened this issue Jul 5, 2023 · 2 comments
Open

Real does not deserialize #95

heyx3 opened this issue Jul 5, 2023 · 2 comments

Comments

@heyx3
Copy link

heyx3 commented Jul 5, 2023

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
@heyx3 heyx3 changed the title Real does not currently parse. Real does not deserialize Jul 5, 2023
@quinnj
Copy link
Member

quinnj commented Jul 6, 2023

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

@heyx3
Copy link
Author

heyx3 commented Jul 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants