在JSP中解析JSON响应

时间:2016-10-06 10:50:44

标签: json jsp

{"name":"Arnav","surname":"Rodrigues","gender":"male","region":"India"}

如何在JSP / Java中解析此JSON响应。

对于Ex:

Name: Arnav
Surname: Rodrigues

1 个答案:

答案 0 :(得分:0)

String jsonStr = '{"name":"Arnav","surname":"Rodrigues","gender":"male","region":"India"}';
JSONObject myObject = (JSONObject) JSONValue.parse(jsonStr);  
// myObject.name, myObject.surname, ...