kotlin jsonobject get nested
val jsonString = """
{
"urls": {
"raw": "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9",
"full": "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&q=80",
"regular": "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&fit=crop&w=1080&q=80&fit=max",
"small": "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&&fm=jpg&w=400&fit=max",
"thumb": "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&w=200&fit=max"
}
}
""".trimIndent()
val json = JSONObject(jsonString)
val rawUrl = json.getJSONObject("urls").getString("raw")
Also in Java:
- java logical operator
- how to count the number of occurrences of an element in a arraylist in java
- jbutton close jframe java
- map multiple fields from java stream
- find frequency of each word in a string in java
- how to detect if someone clicks on a jpanel in java
- how to write queries in java
- count occurrences of character in string java 8
- int to string java
- how to set a variable java
- hashmap get value by key java
- java stream find specific element
- android how to know when snackbar is done
- update value of an arraylist java
- split with multiple condition in java
- create notification android
- diagonal difference hackerrank solution in java 8 using list
- google translate
- javadoc reference general toString
- Error creating bean with name 'dataSource' defined in class path resource
- java how to get current date
- java declare an int inside an if statement
- string replace last character java
- how to check how many anagrams a word has in java