Site icon Android Tutorial Online

Json Generator From Kotlin

Json Generator

Generate Json File With Simple Function

Screen Shot

How To Use

Tools

Using JsonGenerator

JsonGenerator.Builder().createJson(JsonArgument(fileName, data))

Sample

object SimpleGenerator {

    fun run() {
        val random = (80..90)

        val server1 = Server("amirisback.github.io", "192.168.0.1", random.random())
        val server2 = Server("frogobox.github.io", "192.168.0.1", random.random())

        val serverList = listOf(server1, server2)
        val serverModel = BaseModel(serverList)

        JsonGenerator.Builder().createJson(
            argument = JsonArgument(
                fileName = "server",
                data = serverModel
            )
        )
    }

}

Colaborator

Very open to anyone, I’ll write your name under this, please contribute by sending an email to me

Name Of Contribute

Waiting for your contribute

Attention !!!

GitHub

View Github

Exit mobile version