I'm using JSoup to authenticate then connect to a website. Some URL have a JSON response (because part of the site is in AJAX). Can JSoup handle JSON response ?
Connection.Response doc = Jsoup.connect("...")
.data(...)
.cookie(...)
.header(...)
.method(Method.POST)
.execute();
String result = doc.body()
In my case body is "".
- Is it because JSoup don't know how to handle JSON ? (offcourse there is no )
- Or because there is an error in my request ?
Is there JSoup like libraries for JSON ?
You can fetch JSON or other data format using this:
You should use a JSON library to process JSON Data.
Here are some: Click
Try Like This
Use Header "Accept:text/javascript"
I don't think Jsoup will execute Javascript. If the provided URL returns any non-html text, I believe Jsoup will just wrap it in a body tag or something similiar.
See this post for a suggestion