Extracting a value from a JSON file and storing it in an environment variable

Context: I’m running a batch file on a Windows machine that sends a HTTP GET request to a server and returns the result in JSON form. I have managed to automate this process in a Jenkins Pipeline. When I view the console output, the data is there.

Question: Is there someway to extract specific data from this JSON output and store the value in an environment variable in the Jenkins?

Any assistance in this matter is greatly appreciated!

script {
  env.GOOGLE = readJSON(file: "./foo.json").GOOGLE
1 Like