This is risky because JSON.stringify() will blindly turn any data you give it into a string (so long as it is valid JSON) which will be rendered in the page. If { data } has fields that un-trusted users can edit like usernames or bios, they can inject something like this:
json
{
username: "pwned",
bio: "</script><script>alert('XSS Vulnerability!')</script>"
}

