Problem escaping string inside JSON-LD with Google Tag Manager

To retrieve the description string from the meta tag:

<meta name="description" content="Impara a creare dati strutturati senza l'uso di plugin">

I use the following JavaScript function:

function() {
     var metaElement = document.querySelector('meta[name="description"]');
    return metaElement ? metaElement.getAttribute('content') : '';
}

Next, I will inject the variable previously saved in a Google Tag Manager trigger into the JSON-LD structured data:

<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "description": "{{MetaDescription blogposting}}"
    }
</script>

However, when the string is injected, this problem occurs:

"description": "Impara a creare dati strutturati senza lx27uso di plugin"

How can I solve this problem, because the data is modified for some reason by something when it is injected into the json-ltd