I recommend doing the following:
jq -Mnc ".expiry = \"${expiration}\" | .files[0] = { name: \"${description}\", lexer: \"${language}\", content: \"${content}\" }"
It will add a dependency on the jq utility; however, jq can also be used in geturl to parse JSON output instead of relying on regular expressions.
Using jq also enables the removal of some of the escape functions used below.
Originally posted by @nvinson in #16 (comment)