JSON data reloading Issue

I stored a JSON file containing a lot of data.

For example, I have a global variable SOURCE that contains the JSON path. There is also a second global variable TITLE that fetches the title from the source using the wget JSON formula.

It works fine. However, the problem arises when the data in the JSON file is changed—Kustom does not immediately update the data in the global variable.

I tried various workarounds, but none of them worked. For instance, I used the formula $if(df(ss)=K,W)$ after the main formula to update the global every second. I also tried using the RAW formula and then reading it as JSON (this failed miserably and did not work). Additionally, using the LV formula didn’t work either. I attempted to update the path every minute via flow, but this was also unsuccessful. I’ve tried every possible method I know, but all have failed.

I need your help to update the global variables as soon as the JSON file gets updated.

Kustom caches paths, even local ones, you can either load the file using a flow (this will always reload the file) or, if you are using a file:/// uri, you can append a random parameter at the end like file:///myfile?foo=$df(HH)$ (this will update every hour).

How would I load the file with flow?

file:///myfile?foo=$df(HH)$

What’s foo here? and I just tried this it did not work, output was blank.

Can you please provide your current formula? The working one

Can you please provide your current formula? The working one

Of course!

My gv(SOURCE) is:

file:///sdcard/Kustom/list.json

and gv(TITLE) is:

$wg(gv(source), json, "['" + gv(count) + "']" + ['title'])$

Sorry for the late reply, you cannot do this with local files, best approach is to use a flow, just use a flow that will read your file every X minutes, you can pick the file using the Document action, this will not cache anything and allow you parsing the file via

$wg(#last, json, ...)$

So basically:

  • Add a flow
  • Add a cron / formula trigger (with formula trigger you can use a global to trigger it by setting the global to a different value from Tasker or external apps)
  • Add a Document action to read the file
  • Add your wg formula as above
  • Set global

This topic was automatically closed 25 days after the last reply. New replies are no longer allowed.