# Sampling JSON-LD

**URL:** <https://discuss.httparchive.org/t/sampling-json-ld/1347>\
**Category:** Analysis\
**Created:** [May 3, 2018, 6:36pm UTC](https://discuss.httparchive.org/t/sampling-json-ld/1347 "2018-05-03T18:36:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rviscomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/rviscomi/32/835_2.png) [@rviscomi](https://discuss.httparchive.org/u/rviscomi)\
**Post date:** [May 3, 2018, 6:36pm UTC](https://discuss.httparchive.org/t/sampling-json-ld/1347/1 "2018-05-03T18:36:23Z")

</div>

Researching the state of structured data on the web in preparation for an upcoming [Lighthouse audit](https://github.com/GoogleChrome/lighthouse/issues/4359). Came up with this query to extract a sample of JSON-LD snippets from the top sites:

```sql
SELECT
  rank,
  url,
  data
FROM (
  SELECT
    url,
    JSON_EXTRACT(
      REGEXP_EXTRACT(body,
      '(?i)<script type=[\'"]?application/ld\\+json[\'"]?>(.*)</script>'), '$') AS data
  FROM
    `httparchive.response_bodies.2018_04_15_desktop`
  WHERE
    body LIKE '%application/ld+json%')
JOIN
  `httparchive.summary_pages.2018_04_15_desktop`
USING
  (url)
WHERE
  data IS NOT NULL AND
  rank IS NOT NULL
ORDER BY
  rank
LIMIT
  100

```

_Warning: running queries like this that process response bodies will consume your entire free monthly quota (1 TB)_

The results are in [this sheet](https://docs.google.com/spreadsheets/d/1z6RFRW6aVzt8oNnJJxYNFKAw4eJDsxRMuSngmyJaUAI/edit?usp=sharing).

Using this sample, we can see what the popular JSON-LD properties are and what kinds of validation would be most impactful in a Lighthouse audit.
