From 09aee2a73b7f15cadcb48fcc433f30b256742cc6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Mar 2025 13:45:32 +0300 Subject: fix for parsing strings as integers --- libs/libjson/src/internalJSONNode.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libs/libjson/src/internalJSONNode.h') diff --git a/libs/libjson/src/internalJSONNode.h b/libs/libjson/src/internalJSONNode.h index 2ad616fbcd..133c0f4d0c 100644 --- a/libs/libjson/src/internalJSONNode.h +++ b/libs/libjson/src/internalJSONNode.h @@ -302,6 +302,8 @@ inline long internalJSONNode::as_int(void) const { switch(type()) { case JSON_NULL: return 0; + case JSON_STRING: + return atoi(_string.c_str()); case JSON_BOOL: return _value._bool ? 1 : 0; } @@ -317,6 +319,8 @@ inline json_number internalJSONNode::as_float(void) const { switch(type()) { case JSON_NULL: return (json_number)0.0; + case JSON_STRING: + return atof(_string.c_str()); case JSON_BOOL: return (json_number)(_value._bool ? 1.0 : 0.0); } -- cgit v1.2.3