{"id":28713216,"url":"https://github.com/andreaspitzer/mx2json","last_synced_at":"2026-05-18T06:39:36.965Z","repository":{"id":57305936,"uuid":"219266054","full_name":"andreaspitzer/mx2json","owner":"andreaspitzer","description":"Convert a Machinations model from Google Docs to JSON","archived":false,"fork":false,"pushed_at":"2019-11-03T22:28:27.000Z","size":262,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-20T18:21:04.484Z","etag":null,"topics":["coreloop","gamedesign","google-sheet","json","machinations"],"latest_commit_sha":null,"homepage":"https://mx2json.now.sh","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreaspitzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-03T07:27:45.000Z","updated_at":"2024-02-10T18:27:48.000Z","dependencies_parsed_at":"2022-09-06T19:40:29.796Z","dependency_job_id":null,"html_url":"https://github.com/andreaspitzer/mx2json","commit_stats":null,"previous_names":["andreaspitzer/mx2json","andreaspizsa/mx2json"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/andreaspitzer/mx2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaspitzer%2Fmx2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaspitzer%2Fmx2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaspitzer%2Fmx2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaspitzer%2Fmx2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreaspitzer","download_url":"https://codeload.github.com/andreaspitzer/mx2json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreaspitzer%2Fmx2json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33167929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coreloop","gamedesign","google-sheet","json","machinations"],"created_at":"2025-06-15T00:08:42.213Z","updated_at":"2026-05-18T06:39:36.960Z","avatar_url":"https://github.com/andreaspitzer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mx2json\n\nCreate a JSON representation of a Machinations Google Doc\n\n\u003e ⚠️ This is WIP. You’ll need quite a few things for this:\n\u003e 1. A Google Docs API Key with `spreadsheets.readonly` permissions\n\u003e 2. The ID of your Google Sheet\n\u003e 3. use 1 \u0026 2 to create the API URL to your Google Doc, something like `https://sheets.googleapis.com/v4/spreadsheets/18J84rwqwC9AuyabZAK9d4JM6cUZn8jBnhZoT0NHMTp8/values/A%3AZ?key=…`\n4. `curl` this, optionally store the result in a file\n\n## Hosted Service\n\nA current version of this code can be called from\n\n`https://mx2json.now.sh/replace-with-your-google-doc-id`\n\nwhere, obviously, `replace-with-your-google-doc-id` is your Google Sheets document id.\n\nYou will have to authenticate this either with an `Authorization` header, a `token` parameter in the request.\n\n## CLI\n\n`mx2json` always reads from `stdin`. Use the pipe (`|`) or redirect (`\u003c`) operators.\n\n##### Read from a file\n`$ mx2json \u003c curl https://....`\u003cbr/\u003e\n\n##### Read from a URL\n`$ curl https://.... | mx2json`\n\n## API\n\n`mx2json(doc, toJson)`\n\n**`doc`** is the Machinations Google Sheet, either in JSON or already parsed Object.\n\n**`toJson`** `boolean` or `function`. Set to `true` to get a JSON. Pass a `function`, to get the return value of that function.\n\n```js\nconst mx2object = require('mx2json')\nconst model = mx2object(myDoc)\nconst json = mx2object(myDoc, true)\nconst custom = mx2object(mDoc, doc =\u003e /* whatever */)\n```\n\n# Example Result\n\n```json\n{\n  \"diagramProperties\": {\n    \"name\": \"Untitled\",\n    \"url\": \"https://my.machinations.io/diagram/22179\",\n    \"owner\": \"Andreas Pizsa\",\n    \"creationDate\": \"10/22/2019\",\n    \"lastChange\": \"10/31/2019\",\n    \"timeInterval\": 1,\n    \"timeStepsLimit\": 100,\n    \"numberOfRunsBatch\": 10,\n    \"numberOfRunsTotal\": 20\n  },\n  \"globalVariables\": [\n    {\n      \"id\": 1,\n      \"name\": \"Dice\",\n      \"value\": \"D6\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Skill\"\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Multiplayer\"\n    },\n    {\n      \"id\": 4,\n      \"name\": \"Strategy\"\n    }\n  ],\n  \"pools\": [\n    {\n      \"id\": 11,\n      \"label\": \"\",\n      \"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\\\"}}}\",\n      \"style\": \"shape=pool-shape;whiteSpace=wrap;html=1;strokeWidth=2;aspect=fixed;resizable=0;fontSize=16;fontColor=#000000;strokeColor=#000000;\",\n      \"activation\": \"passive\",\n      \"activationMode\": \"pull-any\",\n      \"resources\": 10,\n      \"resourcesColor\": \"Black\",\n      \"capacityLimit\": -1,\n      \"capacityDisplay\": 25,\n      \"overflow\": \"block\",\n      \"showInChart\": 0\n    },\n    {\n      \"id\": 15,\n      \"label\": \"\",\n      \"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\\\"}}}\",\n      \"style\": \"shape=pool-shape;whiteSpace=wrap;html=1;strokeWidth=2;aspect=fixed;resizable=0;fontSize=16;fontColor=#000000;strokeColor=#000000;\",\n      \"activation\": \"interactive\",\n      \"activationMode\": \"push-any\",\n      \"resources\": 5,\n      \"resourcesColor\": \"Black\",\n      \"capacityLimit\": -1,\n      \"capacityDisplay\": 25,\n      \"overflow\": \"block\",\n      \"showInChart\": 0\n    }\n  ],\n  \"resourceConnections\": [\n    {\n      \"id\": 14,\n      \"label\": 1,\n      \"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\\\"}}]}\",\n      \"style\": \"shape=resource-connection;endArrow=classic;html=1;strokeWidth=2;fontSize=16;fontColor=#000000;strokeColor=#000000;\",\n      \"source\": 15,\n      \"target\": 11,\n      \"transfer\": \"interval-based\",\n      \"colorCoding\": 0,\n      \"colorCodingColor\": \"Orange\",\n      \"shuffleSource\": 0,\n      \"limitsMinimum\": -9999,\n      \"limitsMaximum\": 9999\n    }\n  ],\n  \"stateConnections\": [\n    {\n      \"id\": 16,\n      \"label\": \"\u003e0\",\n      \"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\\\"}}}}\",\n      \"style\": \"shape=state-connection;endArrow=classic;dashed=1;dashPattern=4 3;html=1;strokeWidth=2;fontSize=16;fontColor=#000000;strokeColor=#000000;\",\n      \"source\": 11,\n      \"target\": 14,\n      \"colorCoding\": 0,\n      \"colorCodingColor\": \"Black\"\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaspitzer%2Fmx2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreaspitzer%2Fmx2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaspitzer%2Fmx2json/lists"}