Java 我使用JAXB将XML转换为json。现在,我如何从中提取特定内容?
有没有其他不必使用JSONObject的方法 我的代码:(到目前为止我已经试过了)Java 我使用JAXB将XML转换为json。现在,我如何从中提取特定内容?,java,json,xml,jaxb,Java,Json,Xml,Jaxb,有没有其他不必使用JSONObject的方法 我的代码:(到目前为止我已经试过了) @Path(“rdescriptions”) @得到 @生成(“应用程序/json”) public RSet getRDescriptions()抛出JAXBEException{ File File=新文件(“../RSet.xml”); JAXBContext JAXBContext=JAXBContext.newInstance(RSet.class); Unmarshaller um=jaxbConte
@Path(“rdescriptions”)
@得到
@生成(“应用程序/json”)
public RSet getRDescriptions()抛出JAXBEException{
File File=新文件(“../RSet.xml”);
JAXBContext JAXBContext=JAXBContext.newInstance(RSet.class);
Unmarshaller um=jaxbContext.createUnmarshaller();
RSet rs=(RSet)um.unmarshal(文件);
返回rs;
}
生成的JSON:
"Rule":[{"ID":"t1","desc":"Something","order":1,"result":{"com":0,"no":
{"word":[{}]}},"we":{"T":[{"set":0,"IS":{"v":{"EF":[{}]}}}]}},
{"ID":"t2","desc":"Html","order":1...]
我只想提取每个的ID。有人能解释一下怎么做吗?RSet的代码在哪里?您想要的输出是什么?RSet的代码在哪里?你期望的输出是什么?