使用com.alibaba.fastjson.JSON将这个json数据转化,使其可以在java中去除对应值{"addvcd":"","areacd":"","stcd":"","rvcd":"","zdycd":"","zdqh_geojson":{}}
时间: 2023-11-30 15:03:12 浏览: 83
以下是使用com.alibaba.fastjson.JSON将json数据转化的示例代码:
```java
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
public class JsonTest {
public static void main(String[] args) {
String jsonStr = "{\"addvcd\":\"\",\"areacd\":\"\",\"stcd\":\"\",\"rvcd\":\"\",\"zdycd\":\"\",\"zdqh_geojson\":{}}";
JSONObject jsonObject = JSON.parseObject(jsonStr);
String addvcd = jsonObject.getString("addvcd");
String areacd = jsonObject.getString("areacd");
String stcd = jsonObject.getString("stcd");
String rvcd = jsonObject.getString("rvcd");
String zdycd = jsonObject.getString("zdycd");
JSONObject zdqh_geojson = jsonObject.getJSONObject("zdqh_geojson");
System.out.println(addvcd);
System.out.println(areacd);
System.out.println(stcd);
System.out.println(rvcd);
System.out.println(zdycd);
System.out.println(zdqh_geojson);
}
}
```
输出结果为:
```
{}
```
阅读全文