Json parsing with java

59 views
Skip to first unread message

Richard Wallace

unread,
Jun 21, 2016, 5:51:22 PM6/21/16
to Tasker
I'm trying to parse my personal reddit Json feed to check for new messages, replies, comments etc.

So far I am able to get what I need in very basic JavaScriptlet.
What I really need to so (I think) is loop over each Json entry and add it to a locally set array if field "new" = true.
This is where I'm stuck!
Here is what I have:.
getReddit (96)

A1: HTTP Get [ Server:Port:https://www.reddit.blah.blah Path: Attributes: Cookies: User Agent: Timeout:10 Mime Type: Output File:Documents/tesdit.txt Trust Any Certificate:Off ]

A2: JavaScriptlet [ Code:var obj = JSON.parse(global('HTTPD'));

var len = obj.data.children.length;

var test = obj.data.children[0].data.new;

var title = obj.data.children[0].data.link_title;

var body = obj.data.children[0].data.body; Libraries: Auto Exit:On Timeout (Seconds):45 ]

A3: Flash [ Text:%title

%body

%len Long:On ]

joaomgcd

unread,
Jun 22, 2016, 5:12:09 AM6/22/16
to Tasker
Not to derail but have you tried AutoTools yet? :) It has a very easy way to read stuff from JSON.

Richard Wallace

unread,
Jun 22, 2016, 5:34:15 AM6/22/16
to Tasker
Hi again....
No I haven't. Like ive said before, I am not looking to buy / subscribe to plugins when it's fully achievable within Tasker natively.
Sheesh...pushy sales men...😉

João Dias

unread,
Jun 22, 2016, 6:42:00 AM6/22/16
to tas...@googlegroups.com
Actually the app is free right now :P But yeah, I can understand your point of view.


--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/TRm5ORvDGR0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Juergen Gruen

unread,
Jun 24, 2016, 5:28:03 AM6/24/16
to Tasker
Hi Richard,

could you provide an example of the resulting json data?


Juergen.

Robert Ryan

unread,
Jun 24, 2016, 10:57:41 AM6/24/16
to Tasker
You could try Java's built-in JSONObject.
Reply all
Reply to author
Forward
0 new messages