All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.grab.grazel.util.GrazelJson.kt Maven / Gradle / Ivy

The newest version!
package com.grab.grazel.util

import kotlinx.serialization.json.decodeFromStream
import org.gradle.api.file.RegularFile
import java.io.File
import kotlinx.serialization.json.Json as KotlinJson

// Inject?
internal val Json = KotlinJson {
    explicitNulls = false
    ignoreUnknownKeys = true
}

internal inline fun  fromJson(file: RegularFile): T = fromJson(file.asFile)
internal inline fun  fromJson(json: File): T = json
    .inputStream()
    .buffered()
    .use { stream -> Json.decodeFromStream(stream) }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy