* fix #18007: std/json now serializes nan,inf,-inf as raw strings instead of invalid json * fix roundtrip * fix tests * fix changelog * simplify * add runnableExamples * fix typo [skip ci]
This commit is contained in:
parent
63fcb9e5f5
commit
d83b25db1e
5 changed files with 119 additions and 51 deletions
|
|
@ -12,6 +12,9 @@ runnableExamples:
|
|||
let a = (1.5'f32, (b: "b2", a: "a2"), 'x', @[Foo(t: true, z1: -3), nil], [{"name": "John"}.newStringTable])
|
||||
let j = a.toJson
|
||||
assert j.jsonTo(typeof(a)).toJson == j
|
||||
assert $[NaN, Inf, -Inf, 0.0, -0.0, 1.0, 1e-2].toJson == """["nan","inf","-inf",0.0,-0.0,1.0,0.01]"""
|
||||
assert 0.0.toJson.kind == JFloat
|
||||
assert Inf.toJson.kind == JString
|
||||
|
||||
import json, strutils, tables, sets, strtabs, options
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue