我有这个JSON对象(https://gist.github.com/anonymous/4947388/raw/9efc07f1ac8442c459cf3c6c912d953e2efc6949/stackoverflow.json),我想遍历并访问特定键的值,如streetAdress或surname,并将它们存储为字符串。我想在Java中使用JSON Object或jackson,任何提示吗?
由于
答案 0 :(得分:2)
String JSON_DATA;
String streetAddress = "";
String surname = "";
int tempPos = JSON_DATA.indexOf("StreetAddress");
streetAddress = JSON_DATA.substring(tempPos+14)
int deliminator = streetAddress.indexOf(",");
streetAddress = streetAddress.substring(0,deliminator);
现在streetAddress的街道地址值为
现在为姓氏
做同样的事