I have been trying to assign the output received from the PROJECT_DETAILS
environmental variable.
PROJECT_NAME="FRONTEND"
echo $PROJECT_DETAILS | jq ".$PROJECT_NAME.PATH" # works
OUTPUT=$PROJECT_DETAILS | jq ".$PROJECT_NAME.PATH" # doesnt work
echo $OUTPUT # empty
Maybe this is the asynchronous operation of parsing and taking time. How to handle this?
So that with one variable declared, I am trying to access other properties from output
Solved using
OUTPUT=$(echo $PROJECT_DETAILS | jq ".$PROJECT_NAME") # works
In javascript we access JSON properties like:
OUTPUT={name: 'John', address: {street: 'svl'}}
OUTPUT.address.street
Can we do something similar from the above OUTPUT?