aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-10-13 03:37:40 +0200
committerRobert Jaros <rjaros@finn.pl>2018-10-13 03:37:40 +0200
commitebce2c4b839c0b2f8be78bc31c1ce12c45a0164c (patch)
tree7cac3c5449eb8aa398b279d62d9a67ed34fa4115 /src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
parent470953c78c2509224bb452c16f8bbea54e53b3d7 (diff)
downloadkvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.tar.gz
kvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.tar.bz2
kvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.zip
Major refactoring of the multi-platform components.
Dependencies upgrade. A lot of code style fixes.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt b/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
new file mode 100644
index 00000000..e47351ac
--- /dev/null
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/JSON.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017-present Robert Jaros
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package pl.treksoft.kvision.utils
+
+import kotlinx.serialization.context.SimpleModule
+import kotlinx.serialization.json.JSON
+import pl.treksoft.kvision.types.DateSerializer
+import kotlin.js.Date
+
+object JSON {
+
+ val plain = JSON().apply {
+ install(SimpleModule(Date::class, DateSerializer))
+ }
+
+ val nonstrict = JSON(strictMode = false).apply {
+ install(SimpleModule(Date::class, DateSerializer))
+ }
+
+}