html2json 0.5.7

HTML to JSON extractor
Documentation
import { extract } from "npm:@qretaio/html2json";

const html = `
  <article class="post">
    <h2>My Article</h2>
    <p class="author">John Doe</p>
    <div class="tags">
      <span>rust</span>
      <span>wasm</span>
    </div>
  </article>
`;

const spec = JSON.stringify({
  title: "h2",
  author: ".author",
  tags: [
    {
      $: ".tags span",
      name: "$",
    },
  ],
});

const result = await extract(html, spec);
console.log(JSON.parse(result));
// {
//   "title": "My Article",
//   "author": "John Doe",
//   "tags": [{"name": "rust"}, {"name": "wasm"}]
// }