Parsing Newline-delimited JSON (NDJSON,application/x-ndjson) with Retrofit and kotlinx.serialization
val retrofit: Retrofit=Retrofit.Builder()
//........
.addConverterFactory(Json.newNdJsonFactory())
.addConverterFactory(Json.asConverterFactory(
"application/json; charset=UTF8".toMediaType())))
//........
.build()
@POST("/api/generate")
suspend fun generate(@Body body: GenerateRequest): Flow<GenerateResponse>