1// gradle:
2repositories {
3 flatDir {
4 dirs 'libs'
5 }
6}
7
8
9dependencies {
10 implementation name: 'json' // download here: https://search.maven.org/remotecontent?filepath=org/json/json/20210307/json-20210307.jar
11 implementation 'com.github.javadev:underscore:1.66'
12}
13// kotlin
14import org.json.*
15import com.github.underscore.lodash.U
16
17[...]
18
19val jsonString: String = U.xmlToJson(xml)
20val json: JSONObject = JSONObject(jsonString)
21
22// java
23import org.json.*;
24import com.github.underscore.lodash.U;
25
26private string jsonString = U.xmlToJson(xml);
27private JSONObject json = JSONObject(jsonString);