How to compare json object with a string?
<p>I am making a API call which will return <strong>JSON</strong> in the body and I want to compare <strong>JSON</strong> object with a <strong>String</strong>. How can I do that?</p>

<p>API <code>res.body</code> returns following JSON object: </p>

<pre><code>{
    "name": "tenant_tree",
    "documents": [
        {
            "tags": [],
            "scope": "all",
            "tenant_id": "0",   
            "id": "9dd2c5a5-2de2-4ac8-b195-04290f83b6fb",
            "version": 1,     
            "description": "",
            "name": "0",
            "grouping": "",
            "perm_read": "all",
            "perm_write": "all",
            "version_author": "dg",
            "version_date": 1470324147050,
            "is_current": true,
            "dependencies_guid": [""],
            "dependencies_name": [""],
            "display_name": "system"
        },
 }
</code></pre>

<p>I want to compare something like <code>expect(res.body).toMatch('"name": "0"');</code>  but this fails.  </p>