# JSON3 - How write(serialize) the specified number of significant digits?

**URL:** <https://discourse.julialang.org/t/json3-how-write-serialize-the-specified-number-of-significant-digits/47633>\
**Category:** General Usage\
**Created:** [October 2, 2020, 11:20am UTC](https://discourse.julialang.org/t/json3-how-write-serialize-the-specified-number-of-significant-digits/47633 "2020-10-02T11:20:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Martin\_Florek](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)\
**Post date:** [October 2, 2020, 8:17pm UTC](https://discourse.julialang.org/t/json3-how-write-serialize-the-specified-number-of-significant-digits/47633/4 "2020-10-02T20:17:00Z")

</div>

Thanks, guys @StefanKarpinski & @Palli for a quick response and recommendations. I found a mistake with constructor `obj[:w] ./ sum(obj[:w])` where GMMmodel expects exactly 1.0 and the SHA256 signature did not fit. Sorry 😃 I also applied round in the constructor of a struct.

However, I have a new problem with valid writing a vector or value using serialization (method `JSON3.write`). I would expect to write the vector as a valid JSON format (and a simple format for other parsers). For e.g vector `Foo([2.3, 4.5, NaN], NaN)` as

> { “a”: [2.3, 4.5, null], “b”: null} #This is expected 🙂

As I mentioned in the [link](https://discourse.julialang.org/t/ann-json3-jl-1-0-release-new-structtypes-jl-package/34700/2). Some suggestions for (de)serialize?

I tried to choose a number as a string.

> JSON3.StructType(::Type{\<:Float64}) = JSON3.StringType()

but I’ll just get only this `{"a": ["2.3", "4.5", "null"], "b": "null"}` ☹ duplicate quotes 🙄

---

_[View the full topic](https://discourse.julialang.org/t/json3-how-write-serialize-the-specified-number-of-significant-digits/47633)._
