Which one does Google prefer, Microdata or JSON-LD?

The document that recommends JSON-LD is more recent and it clearly states that Google recommends using JSON-LD where possible (over Microdata) specifically for the following reasons:

  • "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."

  • "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."