Skip to content

fab1an/kotlin-json-stream

Repository files navigation

Kotlin Json Stream - Kotlin-Multiplatform JSON stream serialization

maven central version semver license build status OpenSSF ScoreCard OpenSSF Best Practices

Dokumentation

This library is a kotlin-multiplatform streaming JSON-parser. It is based on OKIO for performance.

API-Docs

https://fab1an.github.io/kotlin-json-stream/

Example

fun test() {
    val json = JsonReader("""{"stringProp":"string", "intProp":0}""")

    json.beginObject()
    json.nextName() shouldEqual "stringProp"
    json.nextString() shouldEqual "string"
    json.nextName() shouldEqual "intProp"
    json.nextInt() shouldEqual 0
    json.endObject()
}
  
infix fun <T> T.shouldEqual(expected: T) {
    assertEquals(expected, this)
}