Skip to content

Commit 9f2f1e8

Browse files
committed
Use the new klazon instance for deserializing JSON
1 parent 767ae05 commit 9f2f1e8

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

android/app/src/main/java/com/httpsms/Models.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
// To parse the JSON, install Klaxon and do:
2-
//
3-
// val welcome4 = Welcome4.fromJson(jsonString)
4-
51
package com.httpsms
62

73
import com.beust.klaxon.Json
84
import com.beust.klaxon.Klaxon
95

10-
private val klaxon = Klaxon()
11-
126
data class ResponseMessage (
137
val data: Message,
148
val message: String,
159
val status: String
1610
) {
1711
companion object {
18-
fun fromJson(json: String) = klaxon.parse<ResponseMessage>(json)
12+
fun fromJson(json: String) = Klaxon().parse<ResponseMessage>(json)
1913
}
2014
}
2115
data class ResponsePhone (
@@ -24,7 +18,7 @@ data class ResponsePhone (
2418
val status: String,
2519
) {
2620
companion object {
27-
fun fromJson(json: String) = klaxon.parse<ResponsePhone>(json)
21+
fun fromJson(json: String) = Klaxon().parse<ResponsePhone>(json)
2822
}
2923
}
3024

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ buildscript {
1212
}
1313

1414
plugins {
15-
id 'com.android.application' version '8.1.0' apply false
16-
id 'com.android.library' version '8.1.0' apply false
15+
id 'com.android.application' version '8.1.1' apply false
16+
id 'com.android.library' version '8.1.1' apply false
1717
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
1818
}
1919

0 commit comments

Comments
 (0)