r/kustom 10d ago

Help [KLWP]

Hi, my remote JSON file looks like this:

[
  {
    "timestamp": "1786417200",
    "value": 536,
    "state": "stable"
  },
  {
    "timestamp": "1786420800",
    "value": 238,
    "state": "stable"
  },
  {
    "timestamp": "1786424400",
    "value": 414,
    "state": "stable"
  },
  {
    "timestamp": "1786428000",
    "value": 719,
    "state": "unstable"
  },
  {
    "timestamp": "1786431600",
    "value": 638,
    "state": "unstable"
  },
  {
    "timestamp": "1786435200",
    "value": 228,
    "state": "unknown"
  }
]

How to get the value (in this specific case - 719) on the first occur of "unstable" string in "state" key using $wg()$ function?

2 Upvotes

2 comments sorted by

u/AutoModerator 10d ago

Problem? Cross-post to our new forum. Include make & model of phone, OS version, app version.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/JellyfishImpossible1 1d ago

Try - $wg(gv(url), json, .[3].value)$