Extract text from JSON

Given the following JSON, what's the best way in Keyboard Maestro to extract the text "Extract this text" to a variable?

{
  "doc": {
    "URL": "https://app.crmworkspace.com",
    "title": "Wealthbox"
  },
  "anchor": {
    "name": "#document",
    "text": ""
  },
  "xpath": "/html/body/div[2]/div[5]/div/div[1]/div[2]/div/div[1]/div[1]/div[3]/div/div[1]/div/div/div[2]/div/h3",
  "firstOnly": true,
  "matches": [
    {
      "name": "H3",
      "text": "Extract this text"
    }
  ]
}

I think best way depends on context, but try this:

%JSONValue%Local_JSON.matches[1].text%

Extract text from JSON.kmmacros (2.7 KB)

2 Likes