0

I'm using Klaxon to convert object to JSON objects but it creates an object like so:

data class Welcome(
    val text: String
)

results in:

{
    text: "some value"
}

But i want something like

"Welcome"{
    text: "Some value"
}

1 Answers1

0

As a solution i switched to using org.json and used the following code to get the result I wanted:

val jsonString = """
    {
        "blog": {
            "title": "$title",
             "content": "$content"
        }
    }
"""
var jsonBlogObject = JSONObject(jsonString)
jsonBlogObject.put("someting", "some value")