Sneak Peek - Tasker Native Easy JSON Reading (Patreon)
Content
The other day I had this idea that it could be fairly (if not totally) compatible to add easy JSON reading to Tasker and today I tried it out! :)
In this version of Tasker, if you have a local variable with some JSON data in it you can easily read it with the dot notation!
For example:
- %person has the value {"name":"João", "location":"Portugal"}
- You can read the name by accessing %person.name
- You can read the location by accessing %person.location
It even works for multiple values (arrays)! Let's say you have
- %people has the value [{"name":"João", "location":"Portugal"},{"name":"Janeca", "location":"England"}]
- You can read all the names by accessing %data.name()
- You can read all the locations by accessing %data.location()
You can use all the normal array operations like %data.name(#) to count the number of names, %data.name(<) to get the last name, etc.
Check out this example Task that will give you the current temperature. Super easy to do now! 😁
I'm aware that this has some limitations right now like for example, what if a JSON field has a Tasker incompatible name? I'll try and see what I can do about it :) Maybe have a separate JSON Read action for those special cases?
In any case, you can try out this new feature with the version below. Enjoy and let me know what you think! 😊
https://drive.google.com/file/d/1SvQFvAxFwCk-hArfO_6wOH0UlvvMGi0z/view?usp=sharing
Files
Previews only