Hello everybody!
Today I’ve been messing around with APIs and one of the few I’ve tried (Pastebin) returns data in the form of an HTML table. I want to convert this table into a JSON object but I’m having some trouble.
There are online converters but I need something I can access “in-code”.
I checked the JSONObject’s methods and I don’t see anything that’ll help.
The code I’m using isn’t all that important, but here it is anyways:
PostRequest post3 = new PostRequest("https://pastebin.com/api/api_post.php");
addKey(post3);
post3.addData("api_user_key",api_userKey);
post3.addData("api_results_limit","5");
post3.addData("api_option","list");
post3.send();
//This here is the returned data:
print(post3.getContent());
//I need to convert this to a JSONObject.
It’s converting to something like this:
Summary
paste>
<paste_key>adAW23</paste_key>
<paste_date>1614664174</paste_date>
<paste_title>Script</paste_title>
<paste_size>227331</paste_size>
<paste_expire_date>0</paste_expire_date>
<paste_private>1</paste_private>
<paste_format_long>Lua</paste_format_long>
<paste_format_short>lua</paste_format_short>
<paste_url>https://pastebin.com/jTZpwNYX</paste_url>
<paste_hits>11</paste_hits>
</paste