For example:
import jsony
type
PayloadKind = enum
kInt
kFloat
Payload = object
case kind: PayloadKind
of kInt:
i: int64
of kFloat:
f: float64
const Input = """{"kind":"kFloat","f":3.14,"kind":"kInt"}"""
when defined(release):
let parsed = Input.fromJson(Payload)
doAssert parsed.kind == kInt
doAssert parsed.i == 4614253070214989087'i64
echo "release corruption reproduced: ", parsed.i
else:
discard Input.fromJson(Payload)
For example: