Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

help with reading json

36 views
Skip to first unread message

Shane Rock

unread,
Dec 20, 2024, 7:08:09 PM12/20/24
to Tasker
Hello,

I'm trying to read the following json object

[{
"id": "this is an ID",
"deviceAssetId": "test1",
"ownerId": "test1",
}, {
"id": "this is an ID 2",
"deviceAssetId": "test2",
"ownerId": "test2",
},
]

using the below tasker task

Task: Read Json
A1: AutoTools Json Read [
Configuration: Simple Mode: true
Json: /storage/emulated/0/Download/AutoTools/immich.json
Fields: id()
Separator: ,
Timeout (Seconds): 60
Structure Output (JSON, etc): On ]

A2: Popup [
Text: %id()
Layout: Popup
Timeout (Seconds): 5
Show Over Keyguard: On ]

However it does not get the data in "id" it just prints %id

but if I change the variable to deviceAssetID it works as expected and returns the correct result, is there something about the text "id" that isn't allowing it to work?

Below is the working task for deviceAssetID

Task: Read Json

A1: AutoTools Json Read [
Configuration: Simple Mode: true
Json: /storage/emulated/0/Download/AutoTools/immich.json
Fields: deviceAssetId()
Separator: ,
Timeout (Seconds): 60
Structure Output (JSON, etc): On ]

A2: Popup [
Text: %deviceassetid()
Layout: Popup
Timeout (Seconds): 5
Show Over Keyguard: On ]

Shane Rock

unread,
Dec 21, 2024, 7:10:00 AM12/21/24
to Tasker
found out it was because the id field was only two characters and needed to be at least three.

João Dias

unread,
Jan 13, 2025, 8:59:14 AMJan 13
to tas...@googlegroups.com
Just so you know, Tasker has native JSON reading that can read fields with 2 characters. Check here: https://tasker.joaoapps.com/userguide/en/variables.html#json

Hope this helps!

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Reply all
Reply to author
Forward
0 new messages