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

mx2json

v1.0.1

Published

Create a JSON representation of a Machinations Google Doc

Readme

mx2json

Create a JSON representation of a Machinations Google Doc

⚠️ This is WIP. You’ll need quite a few things for this:

  1. A Google Docs API Key with spreadsheets.readonly permissions
  2. The ID of your Google Sheet
  3. use 1 & 2 to create the API URL to your Google Doc, something like https://sheets.googleapis.com/v4/spreadsheets/18J84rwqwC9AuyabZAK9d4JM6cUZn8jBnhZoT0NHMTp8/values/A%3AZ?key=…
  1. curl this, optionally store the result in a file

Hosted Service

A current version of this code can be called from

https://mx2json.now.sh/replace-with-your-google-doc-id

where, obviously, replace-with-your-google-doc-id is your Google Sheets document id.

You will have to authenticate this either with an Authorization header, a token parameter in the request.

CLI

mx2json always reads from stdin. Use the pipe (|) or redirect (<) operators.

Read from a file

$ mx2json < curl https://....

Read from a URL

$ curl https://.... | mx2json

API

mx2json(doc, toJson)

doc is the Machinations Google Sheet, either in JSON or already parsed Object.

toJson boolean or function. Set to true to get a JSON. Pass a function, to get the return value of that function.

const mx2object = require('mx2json')
const model = mx2object(myDoc)
const json = mx2object(myDoc, true)
const custom = mx2object(mDoc, doc => /* whatever */)

Example Result

{
  "diagramProperties": {
    "name": "Untitled",
    "url": "https://my.machinations.io/diagram/22179",
    "owner": "Andreas Pizsa",
    "creationDate": "10/22/2019",
    "lastChange": "10/31/2019",
    "timeInterval": 1,
    "timeStepsLimit": 100,
    "numberOfRunsBatch": 10,
    "numberOfRunsTotal": 20
  },
  "globalVariables": [
    {
      "id": 1,
      "name": "Dice",
      "value": "D6"
    },
    {
      "id": 2,
      "name": "Skill"
    },
    {
      "id": 3,
      "name": "Multiplayer"
    },
    {
      "id": 4,
      "name": "Strategy"
    }
  ],
  "pools": [
    {
      "id": 11,
      "label": "",
      "geometry": "{\"_attributes\":{\"x\":\"360\",\"y\":\"110\",\"width\":\"60\",\"height\":\"60\",\"TRANSLATE_CONTROL_POINTS\":\"1\",\"relative\":\"0\",\"as\":\"geometry\"},\"mxPoint\":{\"_attributes\":{\"x\":\"0\",\"y\":\"40\",\"as\":\"offset\"}}}",
      "style": "shape=pool-shape;whiteSpace=wrap;html=1;strokeWidth=2;aspect=fixed;resizable=0;fontSize=16;fontColor=#000000;strokeColor=#000000;",
      "activation": "passive",
      "activationMode": "pull-any",
      "resources": 10,
      "resourcesColor": "Black",
      "capacityLimit": -1,
      "capacityDisplay": 25,
      "overflow": "block",
      "showInChart": 0
    },
    {
      "id": 15,
      "label": "",
      "geometry": "{\"_attributes\":{\"x\":\"150\",\"y\":\"110\",\"width\":\"60\",\"height\":\"60\",\"TRANSLATE_CONTROL_POINTS\":\"1\",\"relative\":\"0\",\"as\":\"geometry\"},\"mxPoint\":{\"_attributes\":{\"x\":\"0\",\"y\":\"40\",\"as\":\"offset\"}}}",
      "style": "shape=pool-shape;whiteSpace=wrap;html=1;strokeWidth=2;aspect=fixed;resizable=0;fontSize=16;fontColor=#000000;strokeColor=#000000;",
      "activation": "interactive",
      "activationMode": "push-any",
      "resources": 5,
      "resourcesColor": "Black",
      "capacityLimit": -1,
      "capacityDisplay": 25,
      "overflow": "block",
      "showInChart": 0
    }
  ],
  "resourceConnections": [
    {
      "id": 14,
      "label": 1,
      "geometry": "{\"_attributes\":{\"x\":\"0\",\"y\":\"0\",\"width\":\"60\",\"height\":\"60\",\"relative\":\"1\",\"TRANSLATE_CONTROL_POINTS\":\"1\",\"as\":\"geometry\"},\"mxPoint\":[{\"_attributes\":{\"x\":\"240\",\"y\":\"148.33333333333337\",\"as\":\"sourcePoint\"}},{\"_attributes\":{\"x\":\"324.8528137423857\",\"y\":\"150\",\"as\":\"targetPoint\"}},{\"_attributes\":{\"x\":\"20\",\"y\":\"10\",\"as\":\"offset\"}}]}",
      "style": "shape=resource-connection;endArrow=classic;html=1;strokeWidth=2;fontSize=16;fontColor=#000000;strokeColor=#000000;",
      "source": 15,
      "target": 11,
      "transfer": "interval-based",
      "colorCoding": 0,
      "colorCodingColor": "Orange",
      "shuffleSource": 0,
      "limitsMinimum": -9999,
      "limitsMaximum": 9999
    }
  ],
  "stateConnections": [
    {
      "id": 16,
      "label": ">0",
      "geometry": "{\"_attributes\":{\"x\":\"0\",\"y\":\"0\",\"width\":\"60\",\"height\":\"60\",\"relative\":\"1\",\"TRANSLATE_CONTROL_POINTS\":\"1\",\"as\":\"geometry\"},\"mxPoint\":[{\"_attributes\":{\"x\":\"420\",\"y\":\"200\",\"as\":\"sourcePoint\"}},{\"_attributes\":{\"x\":\"504.8528137423857\",\"y\":\"140\",\"as\":\"targetPoint\"}},{\"_attributes\":{\"x\":\"20\",\"y\":\"10\",\"as\":\"offset\"}}],\"Array\":{\"_attributes\":{\"as\":\"points\"},\"mxPoint\":{\"_attributes\":{\"x\":\"350\",\"y\":\"290\"}}}}",
      "style": "shape=state-connection;endArrow=classic;dashed=1;dashPattern=4 3;html=1;strokeWidth=2;fontSize=16;fontColor=#000000;strokeColor=#000000;",
      "source": 11,
      "target": 14,
      "colorCoding": 0,
      "colorCodingColor": "Black"
    }
  ]
}