diff --git a/res/plugin.yml b/res/plugin.yml index 932b0d0..9e2347a 100755 --- a/res/plugin.yml +++ b/res/plugin.yml @@ -1,6 +1,6 @@ name: RedLib main: redempt.redlib.RedLib -version: 2024-02-28 02:53 +version: 2024-02-28 03:06 author: Redempt api-version: 1.13 load: STARTUP diff --git a/src/redempt/redlib/json/JSONParser.java b/src/redempt/redlib/json/JSONParser.java index 64facbe..6a0304c 100644 --- a/src/redempt/redlib/json/JSONParser.java +++ b/src/redempt/redlib/json/JSONParser.java @@ -13,7 +13,7 @@ public class JSONParser { public static String toJSONString(Object o) { if (o instanceof String) { - return ((String) o).replace("\\", "\\\\").replace("\"", "\\\""); + return '"' + ((String) o).replace("\\", "\\\\").replace("\"", "\\\"") + '"'; } if (o instanceof Long) { return o + "L"; @@ -84,7 +84,7 @@ private Number integer() { return (int) number; } - private double decimal(long first) { + private Number decimal(long first) { assertChar('.'); int start = pos; Number second = integer(); @@ -143,9 +143,9 @@ private Object object() { case '7': case '8': case '9': - long num = integer(); + Number num = integer(); if (peek() == '.') { - return decimal(num); + return decimal(num.longValue()); } return num; case '.':