klaxon
klaxon copied to clipboard
A JSON parser for Kotlin
Hello ! First of all thank you for the great work ! I ran on something strange, let me know if this is actually a bug or a misusage of...
When I try and parse a nullable enum, I get TypeCastException: ``` import com.beust.klaxon.Klaxon import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull enum class MyEnum { FIRST, SECOND, THIRD }...
As per Kotlin documentation you can define enum constants with their own anonymous classes https://kotlinlang.org/docs/reference/enum-classes.html#anonymous-classes enum class ProtocolState { WAITING { override fun signal() = TALKING }, TALKING { override...
Right now I'm trying to use klaxon to parse following json structure: `{ "score": 50, "itemId": "111", "fields": { "itemType": "ONLINE", "skus": [ "11111", "22222" ], "attributes": { "category": [...
var p = Person().apply { name = "h"; age = 10 } var start = System.currentTimeMillis() var gson = Gson() var psg = gson.toJson(p) var p1 = gson.fromJson(psg,Person::class.java) textView.setText("gson cost:"+(System.currentTimeMillis()...
If I declare a data class with optional parameters like such: ``` kotlin data class classWithOptional(val id: Int, val uploadLink: String?, val uploaded: Boolean) ``` And I have a JSON...
I have the following code and I would expect the regex to match on $.library.books[], but it does not. It only works if the value for "books" field is either...
The library is extremely slow when using object binding. The following code, takes several second to parse the json: ``` val string = """{"message":"This is a test message!"}""" val errorMessage...
val sb = StringBuilder("null") // and also StringBuilder("123") val json = Parser.default().parse(sb) **java.lang.IllegalStateException: Cannot peek next char: EOF reached** val sb = StringBuilder("null\n") val json = Parser.default().parse(sb) **kotlin.KotlinNullPointerException**
Running ```kt data class MyNumber(val number: BigInteger) data class MyList(val list: List) Klaxon().parse("""{"list": [{"number": 123456789000}, {"number": 123456789000000000000}]}""") ``` gives me the following error: ``` Unable to instantiate MyNumber: Parameter number:...