blob: f450d3ba4c4e9e46c46fb4cb3105ee8b54eca769 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package cc.polyfrost.oneconfig.utils;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
public class JsonUtils {
private static final JsonParser PARSER = new JsonParser();
public static JsonParser getParser() {
return PARSER;
}
public static JsonElement parseString(String string, boolean catchExceptions) {
try {
return PARSER.parse(string);
} catch (Exception e) {
if (catchExceptions) {
return null;
} else {
throw e;
}
}
}
public static JsonElement parseString(String string) {
return parseString(string, true);
}
}
|