我使用JAXB将我的XML转换为json。现在,我如何从中提取特定内容?

时间:2015-07-27 16:33:04

标签: java json xml jaxb

是否有其他方法而不必使用JSONObject?

我的代码:(到目前为止我尝试过的)

@Path("rdescriptions")
@GET
@Produces("application/json")
public RSet getRDescriptions() throws JAXBException {
    File file = new File("../RSet.xml");
    JAXBContext jaxbContext = JAXBContext.newInstance(RSet.class);
    Unmarshaller um = jaxbContext.createUnmarshaller();
    RSet rs = (RSet) um.unmarshal(file);
    return rs;


}

 json that gets generated:
 "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。有人可以解释一下如何做到这一点吗?

0 个答案:

没有答案