%JSONValue% from colon-delimited lines

Given a series of colon-delimited lines, like:

Email address: connie.rxxx@gmail.com
Phone number: 9171231234
Zip code: 12345
Message: Hi, we’re in need of xxx
Interested In: xxx, zzz

(from another thread: Why Does This Regex Not Work on This Block of Text?

you can:

  1. Obtain a corresponding JSON record (spaces in the keys replaced with underscores), and
  2. pick out particular values by name, using Keyboard Maestro's %JSONValue% token:

Example:

%JSONValue% from colon-delimited lines.kmmacros (4.1 KB)

Which returns, for example:

Email: connie.rxxx@gmail.com
Zip: 12345

Full JSON record: {
  "Email_address": "connie.rxxx@gmail.com",
  "Phone_number": "9171231234",
  "Zip_code": "12345",
  "Message": "Hi, we’re in need of xxx",
  "Interested_In": "xxx, zzz"
}
4 Likes