# How do I define a data type Real in JSON3?

**URL:** <https://discourse.julialang.org/t/how-do-i-define-a-data-type-real-in-json3/29520>\
**Category:** New to Julia\
**Created:** [October 5, 2019, 12:54pm UTC](https://discourse.julialang.org/t/how-do-i-define-a-data-type-real-in-json3/29520 "2019-10-05T12:54:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elmer\_Cusipuma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elmer_cusipuma/32/11958_2.png) [@Elmer\_Cusipuma](https://discourse.julialang.org/u/Elmer_Cusipuma)\
**Post date:** [October 5, 2019, 12:54pm UTC](https://discourse.julialang.org/t/how-do-i-define-a-data-type-real-in-json3/29520/1 "2019-10-05T12:54:59Z")

</div>

Example:

```julia
using JSON3

struct Car
    model::String
    topSpeed::Real
end

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

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

```

Getting this error when I run test

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

```

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [October 5, 2019, 1:04pm UTC](https://discourse.julialang.org/t/how-do-i-define-a-data-type-real-in-json3/29520/2 "2019-10-05T13:04:45Z")

</div>

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.
