You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't a bug, as it is well documented, but I wanted to raise the possibility of changing this behavior. Possibly related to #47 Simple example
using JSON3
using StructTypes
struct Foo
a::Int64
b::Int64end
StructTypes.StructType(::Type{Foo}) = StructTypes.Struct()
julia> JSON3.read("""{"b": 1, "a": 2}""", Foo).a
1# oops!
The two issues I see are
(in my opinion) - breaks principle of least surprise. Using the "default" julia type (struct) with a JSON parser (unordered), implicitly requires ordered data
Forces uses of mutable structs to safely interact with JSON3
That all said I don't know how technically feasible this is - naively I would think because you know the field order of Foo, the parser could re-order data as it receives it to match, but assume this would at minimum cost some performance.
The text was updated successfully, but these errors were encountered:
This isn't a bug, as it is well documented, but I wanted to raise the possibility of changing this behavior. Possibly related to #47 Simple example
The two issues I see are
struct
) with a JSON parser (unordered), implicitly requires ordered dataThat all said I don't know how technically feasible this is - naively I would think because you know the field order of
Foo
, the parser could re-order data as it receives it to match, but assume this would at minimum cost some performance.The text was updated successfully, but these errors were encountered: