While it is technically absolutely possible, you however shouldn't do this. Indeed, Google is able to see stuff, which is loaded until six seconds after
onLoad. But structured data is a kind of information Google wants to see immediately.
At times, where JSON-LD wasn't there, Google recognized only structured data (microdata or RDFa), applied only to visible HTML elements. Applying of structured data to unvisible elements was able to trigger a penalty.
Neverthenless there were kinds of structured data, which were become redundant, if applied to visible elements, so this caused usage of microdata with
body elements like
<meta itemprop="price" content="EUR" /> or
<link itemprop="url" href="http://example.com" />
Rising of JSON-LD maked strictly speaking any usage of structured data unvisible - JSON-LD is not visible and not applied to any visible element. But the wish of Google remains: to use JSON-LD in the visible part of page.
Here you can see some responses from Google's John Mueller about the topic.