aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt')
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt
new file mode 100644
index 0000000..43e0927
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.JsonUtils
+import com.google.gson.JsonElement
+
+/**
+ * Returns the [JsonElement] of the given [String].
+ *
+ * @see JsonUtils.parseString
+ */
+fun String.asJsonElement(catchExceptions: Boolean = true): JsonElement? = JsonUtils.parseString(this, catchExceptions) \ No newline at end of file