我希望能够在Java操作方法中访问JSON字符串中的属性.只需说出字符串即可myJsonString = object.getJson().下面是字符串的示例:
{
'title': 'ComputingandInformationsystems',
'id': 1,
'children': 'true',
'groups': [{
'title': 'LeveloneCIS',
'id': 2,
'children': 'true',
'groups': [{
'title': 'IntroToComputingandInternet',
'id': 3,
'children': 'false',
'groups': []
}]
}]
}
Run Code Online (Sandbox Code Playgroud)
在此字符串中,每个JSON对象都包含其他JSON对象的数组.目的是提取ID列表,其中任何给定对象拥有包含其他JSON对象的组属性.我把Google的Gson视为潜在的JSON插件.任何人都可以提供某种形式的指导,告诉我如何从这个JSON字符串生成Java?
我正在使用Web客户端.并通过Web客户端成功登录.但是当我发送第二个获取数据的请求时.我有一个例外
com.gargoylesoftware.htmlunit.UnexpectedPage@6d8d73`
Run Code Online (Sandbox Code Playgroud)
但是当我通过url thruogh brouser时,我得到了一个数据Json格式.
码:
webClient.getPage("http://ajax/stream/refresh-box?r=new&id=2323222&")
Run Code Online (Sandbox Code Playgroud)
Thx在先进