I've just started learning structured data and I'm still trying to wrap my head around the concept.
First I started out with Microdata using schema.org vocabulary and now I'm learning JSON-LD.
The thing that is bugging me is that 'how do search engines know that the structured data that I'm providing in the head matches with the content of the page?' because in the specific case of JSON-LD I'm not specifying which element contains what information.
This was not the case in Microdata where I provide the structured data in the element itself. And to add to my confusion I've read in multiple articles that Microdata & JSON-LD have the same result, which means my understanding of Microdata is wrong too!
Please help me with this. Thank you
Think of JSON-LD and MicroData working in compliment. Where there's a lot of content on your page, go with MicroData as the work is already there. You're familiar, and so you know about structuring your page to work with it. JSON-ld is basically an easy short-cut for identification. (This is not intended as an 'expert' answer, but a simple answer for someone still learning the ropes.)