Read JSON information

Report a typo

The input to the following program is a JSON string containing data about a city: its name and population. The program processes this string and prints the relevant data.

Fill in the missing code.

This task uses dependencies that may not be available in your local IDE. As a result, you may see compilation errors or unresolved references when running the code locally. This does not affect solution validation when you submit your solution to Hyperskill.

Sample Input 1:

{"name":"Barcelona","population":170000}

Sample Output 1:

Barcelona 170000
Write a program in Kotlin
import kotlinx.serialization.*
import kotlinx.serialization.json.*

@Serializable
data class City(val name: String, val population: Int)

fun main() {
val jsonString = readln()

val city =

println("${city.name} ${city.population}")
}

Create a free account to access the full topic