summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-05-23 14:06:14 -0700
committerGitHub <noreply@github.com>2021-05-23 23:06:14 +0200
commitd217888e5679aff063668930bd00892c4f5cb2b3 (patch)
treeca4ce94abcd4c75dd04576718fc3ea83b7be59bc /lib
parent1421a3bf265e45cea7c26dcaf3be148ea02db5f0 (diff)
downloadNim-d217888e5679aff063668930bd00892c4f5cb2b3.tar.gz
close #18009 parseJson JInt vs JFloat; preserve -0.0 as JFloat to distinguish from 0.0 (#18067)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/json.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index 3a9fa5898..d5bbb86b8 100644
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -938,7 +938,7 @@ when defined(js):
     of "[object Array]": return JArray
     of "[object Object]": return JObject
     of "[object Number]":
-      if isInteger(x):
+      if isInteger(x) and 1.0 / cast[float](x) != -Inf: # preserve -0.0 as float
         if isSafeInteger(x):
           return JInt
         else: