How do I define a data type Real in JSON3?


using JSON3

struct Car

JSON3.StructType(::Type{Car}) = JSON3.Struct()

json = """{"model": "S500","topSpeed": 250.1}"""

Getting this error when I run test

car =,Car)
ERROR: ArgumentError: Real doesn't have a defined `JSON3.StructType`

I don’t know anything about json struct types but you probably do not want to have a Real field in your struct since Real is an abstract type and this will be bad for performance. Consider making Car parametric instead, i.e. Car{T<:Real}. I assume that this will also solve your issue.