We use JSON-LD for many reasons. The Markup is placed inside a script tag in the head of the HTML page. The markup does not have to be interleaved with the user-visible text, which makes nested data items easier to express, such as the Country of a PostalAddress of a MusicVenue of an Event. Also, Google can read JSON-LD data when it is dynamically injected into the page's contents, such as by JavaScript code or embedded widgets in your content management system. Read more about JSON-LD.

JSON-LD is the recommended format. Google is in the process of adding JSON-LD support for all markup-powered features.