Grab specific variable from text

hey there! I want to filter one specific information from a text, but that's a variable and will change all the time. something like this here:

"friendly_name": "Schlafzimmer", "is_coordinator": true, "is_volume_muted": false, "media_album_name": "\"Awaken, My Love!\"", "media_artist": "Childish Gambino", "media_content_type": "music", "media_duration": 326, "media_position": 0, "media_position_updated_at":

from all the text I just need the information"media_artist": "INFORMATION"

The idea is that meastro searches for the combination of words "media_artist": " and grab all the words till the next "

Is that possible with Keyboard Maestro?

How are you accessing this text? Is it in a file? On the clipboard? More info pls.

oh sorry yes, I get all this information from an curl command (calling the REST API from my Home Assistant to be exactly) - this command grabs all the attributes from a state of an entity, but I only want to extract one specific attribute of it and get it displayed as a notification

After searching a bit on the forum here I discovered regular expressions, I'm not sure if that is the right direction to filter the text i want

ah ok found the solution, did it with Regular Expression:

.media_artist": "(.+)", "media_content_type":

Incidentally, as you are fetching a JSON value, if you leave the curly { braces } in place,
a KM Evaluate a JavaScript for Automation can read the whole record for you directly, and return any values that you name.

Read curled JSON value.kmmacros (18.6 KB)
readCurledJSON