HiJson is a lightweight JSON parsing library that can be used for HarmonyOS, Android, and Java
Gradle
implementation 'org.devio.hi.json:hijson:1.0.0'
Maven
<dependency>
<groupId>org.devio.hi.json</groupId>
<artifactId>hijson</artifactId>
<version>1.0.0</version>
</dependency>
Use like so:
jsonString:
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "河北",
"city": "邢台市",
"adcode": "130500",
"weather": "多云",
"temperature": "17",
"winddirection": "北",
"windpower": "≤3",
"humidity": "98",
"reporttime": "2020-09-26 21:58:34"
}
]
}
String city = new HiJson(jsonString).get("lives").get(0).value("city");
System.out.println(city);
Issues are welcome. Please add a screenshot of you bug and a code snippet. Quickest way to solve issue is to reproduce it in one of the examples.
Pull requests are welcome. If you want to change the API or do something big it is best to create an issue and discuss it first.