Skip to content

Commit

Permalink
Fix json parser
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam committed Feb 28, 2024
1 parent 0588c15 commit 4127f62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion res/plugin.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions src/redempt/redlib/json/JSONParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 '.':
Expand Down

0 comments on commit 4127f62

Please sign in to comment.