npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hson

v0.0.2

Published

json compatible html friendly format compiler

Downloads

10

Readme

HSON

Installation

npm install hson

Usage

npm install hson

var HSON = require('hson');

obj = HSON.parse(hsonString);

To see a working example check the hson example repo.

About

This is an easy way of wrting HTML in a JSON alike structure.

HSON covers a subset of JSON, this way HSON will be mapped entirely into a JSON object.

Wasn't XML's CDATA already taking care of this? Yes, but you would have to parse XML. Also XML elements have attributes which are not mapped directly into JSON.

Types of data supported

From the data types suppoted in the JSON definition, HSON currently only supports:

  • objects
  • arrays
  • strings

Support for number, date, boolean and undefined is not currently implemented.

Also, the top level object will be an object and cannot be an an array.

HSON syntax

Objects

What in JSON you would do: { "property": "value" }

In HSON would become: <-property>value</-property>.

Arrays

JSON

{ 
    "anArray": [ 
        { "property": "value" },
        { "property": "value" } 
    ]
}

HSON:

<-arr-anArray>
    <-item>
        <-property>value</-property>
    </-item>
    <-item>
        <-property>value</-property>
    </-item>
</-arr-anArray>

Example

Input HSON string

<-title><h1>This is the <span>Title</span></h1></-title>

<-aBlockOfHtml>

	<h1>Some Title</h1>
	<div>some content</div>

</-aBlockOfHtml>

<-anObject>
	<-aProperty>
		<-hereYouGo>So This is the content</-hereYouGo>
	</-aProperty>
	<-item>
		<div>a malformed html. not our problem
	</-item>
</-anObject>

<-arr-thisIsAnArray>

	<-item>
		<-prop1> something </-prop1>
		<-prop2> 
			<-x> something </-x>
			<-y> something </-y> 
		</-prop2>
		<-prop3> <a href="url">click here</a> </-prop3>
	</-item>

	<-item>
		<-prop1> hi there </-prop1>
		<-prop2> this is an example </-prop2>
		<-prop3> <a href="url">click here again</a> </-prop3>

		<-arr-prop5>
			<-item> item1 </-item>
			<-item> item2 </-item>
		</-arr-prop5>

	</-item>

</-arr-thisIsAnArray>

Output JSON

{
  "title": "<h1>This is the <span>Title</span></h1>",
  "aBlockOfHtml": "\n\n\t<h1>Some Title</h1>\n\t<div>some content</div>\n\n",
  "anObject": {
    "aProperty": {
      "hereYouGo": "So This is the content"
    },
    "item": "\n\t\t<div>a malformed html. not our problem\n\t"
  },
  "thisIsAnArray": [{
    "prop1": " something ",
    "prop2": {
      "x": " something ",
      "y": " something "
    },
    "prop3": " <a href=\"url\">click here</a> "
  }, {
    "prop1": " hi there ",
    "prop2": " this is an example ",
    "prop3": " <a href=\"url\">click here again</a> ",
    "prop5": [" item1 ", " item2 "]
  }]
}