# JSON3 default values

**URL:** <https://discourse.julialang.org/t/json3-default-values/128324>\
**Category:** General Usage\
**Tags:** json3\
**Created:** [April 23, 2025, 9:57am UTC](https://discourse.julialang.org/t/json3-default-values/128324 "2025-04-23T09:57:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [April 23, 2025, 9:57am UTC](https://discourse.julialang.org/t/json3-default-values/128324/1 "2025-04-23T09:57:17Z")

</div>

How can I add default parameters for a struct that is parsed using JSON3.jl ?

Do I need to overload the `StructTypes.construct` method, or is there an easier way?

Something like this:

```julia
import JSON3

struct Foo
    foo::Union{Nothing,Float64}
end

JSON3.read("""{"foo": null}""", Foo)

```

```julia
import JSON3

Base.@kwdef struct Foo
    foo::Float64=1.23
end

JSON3.read("""{"foo": null}""", Foo)

```
