We (developers at <Nimble>) just built a KMM libra...
# multiplatform
l
We (developers at Nimble) just built a KMM library https://github.com/nimblehq/jsonapi-kotlin that supports decoding JSON:API string response. I saw many ppl ask about it (and me too) so feel free to use it. Please don’t forget to give us a star 🌟 It’s being published via GitHub Packages so please check the installation section.
Copy code
@Serializable
data class ExampleModel(val title: String)

val body = """
{
  "data": {
    "type": "articles",
    "id": "1",
    "attributes": {
      "title": "JSON:API paints my bikeshed!"
    }
  }
}
"""

val json = Json {
    prettyPrint = true
    isLenient = true
    ignoreUnknownKeys = true
}
val data = JsonApi(json).decodeFromJsonApiString<ExampleModel>(body)