79163662

Date: 2024-11-06 17:32:28
Score: 1
Natty:
Report link

During assignment to ENV_VAR, add the '\' slash characters to escape the new lines '\n' and double quotes.

ENV_VAR="{\"example\": \"multi\\nline\\n\"}"
echo $ENV_VAR > example.json

Output

cat example.json 
{"example": "multi\nline\n"}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: slovelo