AutoTools AutoTools Json Read - Getting Started

Learn the ins and outs of the Json Read action in AutoTools with several basic examples

  1. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    joaomgcd submitted a new AutoApps project:

    AutoTools Json Read - Getting Started - Learn the ins and outs of the Json Read action in AutoTools with several basic examples

    Read more about this project...
     
  2. wil

    wil New Member

    Joined:
    Dec 21, 2017
    Messages:
    1
    Likes Received:
    0
    Trying to read a json with the format
    Code (Text):
    {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        103.840229,
                        1.347791
                    ]
                },
                "properties": {
                    "name": "Marymount Station",
                    "terrains": [
                        "2017-08-01"
                    ],
                    "dates": []
                }
            },
    Trying to read %features_geometry_coordinates() but turns out blank.. what am I doing wrong?
    I need to reference the lat & long or just return me the whole string/array with the , which is fine as well
     
  3. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance
     
  4. Brian Chee

    Brian Chee New Member

    Joined:
    Nov 21, 2016
    Messages:
    1
    Likes Received:
    0
    I was wondering if you have a way to get the length of a json array. Or did I miss something?

    here is what i have tried:
    streams(#)
    streams[#]
    streams.length
    streams().length
    streams[].length
    streams [ i ] .length -- remove spaces
     
    Last edited: Sep 27, 2018
  5. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    To get the length, read it normally into a Tasker variable, then use %streams(#)
     
  6. qpkorr

    qpkorr New Member

    Joined:
    Jan 3, 2019
    Messages:
    7
    Likes Received:
    0
    Hi - I was just wondering, it is possible to do a JSON Read via a POST request, rather than a GET? I need to supply some parameters in JSON format too...
    Thanks for all your awesome tools!
     
  7. qpkorr

    qpkorr New Member

    Joined:
    Jan 3, 2019
    Messages:
    7
    Likes Received:
    0
    Hmm - other than using the Tasker HTTP Post task and passing the received string via a variable...
     
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Yeah, that should work :) Why don't you want to do that?
     
  9. qpkorr

    qpkorr New Member

    Joined:
    Jan 3, 2019
    Messages:
    7
    Likes Received:
    0
    :) Thanks, done!
     
  10. Humpie

    Humpie New Member

    Joined:
    Apr 7, 2015
    Messages:
    8
    Likes Received:
    1
    Is there also a sense of wildcards in a JSON read query?
    For (my own) app Magical Location Clock I have for instance a JSON query define like this https://mlc.jolanrensen.nl/help/group-data-api#h.pabycv6noigr. I can reach the names of the people using the "simple mode", but I can't seem to get it to work for the advanced mode. I would also like to get an array of the keys in the object.
    I first assumed you used the same system as jsonpath.com (also used by KWGT) with which I could easily find all names using `$.[*].name` and all keys using `$.*~` for instance but it appears your implementation is a bit different.
    Anyways, something like `*.name()` would be really helpful as well as maybe a way to get the keys/values in an object.
     
  11. luks_abido

    luks_abido New Member

    Joined:
    May 13, 2020
    Messages:
    9
    Likes Received:
    0
    I am totally new to javascript. Never used it before.
    I am getting information from this page with HTTP Request and a bunch of Search and Replace. Was wondering if Javascript would slim down the task and I could learn something in the process.
    The output of HTTP Request is this. I tried reading it with AutoTools Json Read, but I get errors about the format.

    In the HTTP Request output data, I see there is a line with the following entry:
    <script type="application/ld+json">​
    Tried using this as the header in HTTP Request, but that didn't change the output data.

    Can anyone point me in the direction of at least getting the output data in Json format?
     

Share This Page