You can add the code anywhere on your website. It doesn’t matter if you place it in the head or the body section. Google will have no problem reading the code.
Since JSON-LD is a data linking format, there are no additional requests to the server. Therefore, it doesn’t matter if the script is loaded at the top or bottom of the page – there is no render delaying whatsoever.