Skip to content

Examples of usage with Google's Structured Data JSON LD? #62

Closed

Description

@tony

Despite this being the premier JSON-LD library for python, the examples are sparse and leave a lot to the imagination. Or maybe it's just me. In frustration I ended up resorting to dicts and json for now, but wanted to see if we could get some more examples and documentation up.

Here are examples of outputting jsonld Google's way:

https://developers.google.com/search/docs/guides/

Breadcrumbs: https://developers.google.com/search/docs/data-types/breadcrumbs

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.example.com/",
  "potentialAction": [{
    "@type": "SearchAction",
    "target": "https://query.example.com/search?q={search_term_string}",
    "query-input": "required name=search_term_string"
  },{
    "@type": "SearchAction",
    "target": "android-app://com.example/https/query.example.com/search/?q={search_term_string}",
    "query-input": "required name=search_term_string"
  }]
}
</script>

https://developers.google.com/search/docs/data-types/logo

{
  "@context": "http://schema.org",
  "@type": "Organization",
  "url": "http://www.example.com",
  "logo": "http://www.example.com/images/logo.png"
}

https://developers.google.com/search/docs/data-types/articles

{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://google.com/article"
  },
  "headline": "Article headline",
  "image": {
    "@type": "ImageObject",
    "url": "https://google.com/thumbnail1.jpg",
    "height": 800,
    "width": 800
  },
  "datePublished": "2015-02-05T08:00:00+08:00",
  "dateModified": "2015-02-05T09:20:00+08:00",
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
   "publisher": {
    "@type": "Organization",
    "name": "Google",
    "logo": {
      "@type": "ImageObject",
      "url": "https://google.com/logo.jpg",
      "width": 600,
      "height": 60
    }
  },
  "description": "A most wonderful article"
}

Activity

  1. gustavorps commented on Aug 8, 2017

    @gustavorps

    +1

  2. tkremmel commented on Feb 1, 2018

    @tkremmel

    It is not just you.. also falling back to dicts and json for now.

  3. davidlehn commented on Feb 1, 2018

    @davidlehn
    Member

    What kind of examples and docs were you all looking for? It could be argued that generic JSON-LD authoring and usage info should be on some other site. Improved docs for pyld in particular would be very welcome. Does anyone have suggestions (or patches!) on what do add?

  4. tkremmel commented on Feb 1, 2018

    @tkremmel

    I tried to build structured data for a BlogPosting. So one suggestion would be to provide more examples which also include nestings.

    {
    	"author": "Tom",
    	"publisher": {
    		"logo": {
    			"width": "234",
    			"name": "mylogo",
    			"url": "https://www.example.com/logo.png",
    			"height": "76",
    			"@type": "ImageObject"
    		},
    		"name": "My Example Orga",
    		"@type": "http://schema.org/Organization"
    	},
    	"datePublished": "2018-01-15",
    	"headline": "My Example Headline",
    	"dateModified": "2018-02-01",
    	"@type": "BlogPosting",
    	"image": "https://www.example.com/media/file/example.jpg",
    	"@context": "http://schema.org"
    }
    
  5. bcipolli commented on May 22, 2020

    @bcipolli

    @davidlehn An example for, given a json-ld file, how would one open it? Use it? Get dependencies? Complete mystery.

  6. added this to the v3.0.0 (JSON-LD 1.1) milestone on Feb 3, 2026
  7. mielvds commented on Sep 1, 2026

    @mielvds
    Collaborator

    Will be available as tutorial in v4.0.0 (#326)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions