turn xml into json code example
Example: convert xml to json java
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation name: 'json'
implementation 'com.github.javadev:underscore:1.66'
}
import org.json.*
import com.github.underscore.lodash.U
[...]
val jsonString: String = U.xmlToJson(xml)
val json: JSONObject = JSONObject(jsonString)
import org.json.*;
import com.github.underscore.lodash.U;
private string jsonString = U.xmlToJson(xml);
private JSONObject json = JSONObject(jsonString);