简体   繁体   中英

Convert RSS feed to JSON in java

Is there any api or something to convert RSS feed to Json ? I used the api rss2json api with restTemplate , it's working fine when you map it with an entity but this one doesn't support multiple requests as it's gets overloaded plus there is no documentation for it or support so if the api goes down so is my app and I couldn't find something similar besides the rome plugin that converts to an object. I want direct conversion to Json.

I'm not sure what you mean by direct conversion to JSON, but you could simply use org.json to convert XML String to JSON String:

String xml = ..
JSONObject jObject = XML.toJSONObject(xml);
String json = jObject.toString();

More discussion here: Converting xml to json using jackson

I finished by using Rome plugin and built my own JSon structure step by step. no better solution so far.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM