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 🙏

© 2025 – Pkg Stats / Ryan Hefner

brokjson

v0.0.4

Published

BrokJSON is a space-saving alternative to GeoJSON. Convert GeoJSON to BrokJSON and vice versa

Downloads

18

Readme

BrokJSON

Ever struggled with huge GeoJSON-Files? BrokJSON is your space-saving alternative! Depending on your data you can save up to 80%. Withouth losing any data! Why? Because it is based on the same ideas as GeoJSON but reduces redundancies.

The idea behind BrokJSON: RAM is mightier than the bandwidth - download the small BrokJSON and convert it on runtime to GeoJSON than loading a huge GeoJSON.

Have a look at https://www.brokjson.dev!

Example

This GeoJSON with just two Points...

{
  "type": "FeatureCollection",
  "features": [
  {
    "type": "Feature",
    "properties": {
      "id": 1,
      "title": "Datapoint 1",
      "value": 343
    },
    "geometry": {
      "type": "Point",
      "coordinates": [8.5402,47.3782]
    }
  },
  {
    "type": "Feature",
    "properties": {
      "id": 1,
      "title": "Datapoint 2",
      "value": 14
    },
    "geometry": {
      "type": "Point",
      "coordinates": [8.5637,47.4504]
    }
  }]
}

... looks as a BrokJSON like this:

{
  "properties": ["id", "title", "value"],
  "geometries": [{
    "type": "Point",
    "features": [
      [[8.5402, 47.3782], [1, "Datapoint 1", 343]],
      [[8.5637, 47.4504], [1, "Datapoint 2", 14]]
    ]
  }
]}

No information lost, everything is there. Amazing!

Installation

Install via NPM

npm install brokjson

Install standalone

Download build/brokjson.min.js
Add it to your Website

<script src='brokjson.min.js'></script>

Usage

Node

// Include BrokJSON
brok = require('brokjson')

// Load your GeoJSON
var geojson = {
  "type": "FeatureCollection",
  "features": [
  {
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [8.5402,47.3782]
    }
  }]
}

// Convert your Json-Object to BrokJson
const brokjson = brok.geo2brok(geojson);

// "brokjson" is your BrokJSON as a javascript object
console.log(brokjson)

// Convert it back
geojson = brok.brok2geo(brokjson)
console.log(geojson)

JavaScript

<script src='brokjson.min.js'></script>
<script>
  // Load your GeoJSON
  var geojson = {
    "type": "FeatureCollection",
    "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [8.5402,47.3782]
      }
    }]
  }

  // Convert your Json-Object to BrokJson
  const brokjson = brok.geo2brok(geojson);

  // "brokjson" is your BrokJSON as a javascript object
  console.log(brokjson)

  // Convert it back
  geojson = brok.brok2geo(brokjson)
  console.log(geojson)
</script>

Documentation

BrokJSON is a lightweight library, there are only two functions.

GeoJSON to BrokJSON

geo2brok(geoJsonObject)

Parameters
GeoJSON as a Javascript-Object

Return value
BrokJSON as a Javascript-Object

BrokJSON to GeoJSON

brok2geo(brokJsonObject)

Parameters
BrokJSON as a Javascript-Object

Return value
GeoJSON as a Javascript-Object

Full Spec and other languages

Have a look at https://www.brokjson.dev