0

I have like this shell script:

#!/bin/bash

JSON_DATA=$(echo $INPUT_DATA | base64 --decode)

echo "JSON:" $JSON_DATA # Result: {"id":546,"sha":"fh456h8"}
 
RP_SHA=$( jq -re  '.sha' <<< $JSON_DATA)
RP_ID=$(jq -re .id <<< $JSON_DATA)

I tried parse like this method but this method return error with message:

syntax error: unexpected redirection

Also tried parse like this:

RP_SHA=\$( jq -re  '.sha' <<< \$JSON_DATA)

This method return error with message:

syntax error: unexpected "("

How I can correctly parse and set to my var json data using jq in my case?

Andreas Hunter
  • 4,504
  • 11
  • 65
  • 125

0 Answers0