June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
15
Task/JSON/Kotlin/json.kotlin
Normal file
15
Task/JSON/Kotlin/json.kotlin
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// version 1.2.21
|
||||
|
||||
data class JsonObject(val foo: Int, val bar: Array<String>)
|
||||
|
||||
data class JsonObject2(val ocean: String, val blue: Array<Int>)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// JSON to object
|
||||
val data: JsonObject = JSON.parse("""{ "foo": 1, "bar": ["10", "apples"] }""")
|
||||
println(JSON.stringify(data))
|
||||
|
||||
// object to JSON
|
||||
val data2 = JsonObject2("water", arrayOf(1, 2))
|
||||
println(JSON.stringify(data2))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue