{"id":20956279,"url":"https://github.com/moxious/json2neo","last_synced_at":"2026-05-07T19:18:43.130Z","repository":{"id":80670335,"uuid":"125391415","full_name":"moxious/json2neo","owner":"moxious","description":"Tools for working with JSON in neo4j","archived":false,"fork":false,"pushed_at":"2018-03-17T13:56:39.000Z","size":199,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T23:38:29.601Z","etag":null,"topics":["cypher","json","neo4j"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moxious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-15T15:54:13.000Z","updated_at":"2022-11-20T18:11:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"850f349e-1c59-4bae-b1a4-3e8408d56938","html_url":"https://github.com/moxious/json2neo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fjson2neo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fjson2neo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fjson2neo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fjson2neo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moxious","download_url":"https://codeload.github.com/moxious/json2neo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243352037,"owners_count":20276916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cypher","json","neo4j"],"created_at":"2024-11-19T01:25:05.687Z","updated_at":"2025-10-25T14:47:46.892Z","avatar_url":"https://github.com/moxious.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build][project-travis-ci-image]][project-travis-ci-url]\n[![codeclimate][project-codeclimate-image]][project-codeclimate-url]\n[![test coverage][project-codeclimate-coverage-image]][project-codeclimate-coverage-url]\n[![npm version][project-npm-version]][project-npm-version-url]\n[![npm dependencies][project-npm-dependencies]][project-npm-dependencies-url]\n[![npm dev dependencies][project-npm-dev-dependencies]][project-npm-dev-dependencies-url]\n\n# json2neo\n\nA module for turning JSON into Neo4j graphs.\n\n## Quick Start \u0026\u0026 Examples\n\n```\nnpm install\n```\n\nSimplest possible example:\n\n```\n$ echo '{\"name\":\"John\", \"friends\":[{\"name\":\"Bob\"}]}' | \\\n./node_modules/.bin/babel-node src/json2cypher.js --stdin \\\n  --label Person\nCREATE (e0:`friends` {`name`: \"Bob\" })\nCREATE (e2:`Person` {`name`: \"John\" })\nMERGE (e2)-[e1:`friends`]-\u003e(e0);\n```\n\nEvery object is a neo4j node; JSON properties that go to other objects indicate\nrelationships to other nodes.  It's about that simple.\n\nFrom there, you'll want to use a mapping file to control how nodes and relationships\nare labeled.  \n\nUse a mapping to take a tweet from the streaming API and turn it into a node set.\n\n```\n./node_modules/.bin/babel-node src/json2cypher.js --file samples/tweet.json \\\n     --label Tweet \\\n     --mapping samples/tweet-mapping.json\n```\n\nConvert this repo's package.json into a graph:\n\n```\n./node_modules/.bin/babel-node src/json2cypher.js --file package.json \\\n     --label JavascriptPackage \\\n     --mapping samples/package-mapping.json\n```\n\n## Command Line Options:\n\n```\njson2cypher [args]\n   --stdin (read JSON data from standard in)\n   --file /path/to/file.json (read JSON data from specified file)\n   --mapping /path/to/mapping-file.json\n   --label MyLabel (Use this label for the root JSON object)\n   --multi treat input source as multiple JSON objects, one per line.\n\n   --create output cypher as a set of create operations\n   --merge output cypher as a set of merge operations (default)\n\n\nProduces cypher on standard output.\n```\n\n## Mappings\n\nA mapping file is just a JSON file that tells the program how to convert a relationship name\nin JSON into either a node label or a relationship type.\n\nFor example, if you have JSON like this:\n\n```\n{\n  \"name\": \"John\",\n  \"friends\": [ { \"name\": \"Bob\" }, { \"name\": \"Susan\" } ]\n}\n```\n\nYou might use a mapping like this:\n\n```\n{\n  \"friends\": {\n    \"label\": \"Friend\",\n    \"relationshipType\": \"HAS_FRIEND\"\n  }\n}\n```\n\nThis would produce a graph where `(John)-[:HAS_FRIEND]-\u003e(:Friend { name: \"Bob\" })`.\n\nBy default, the mapping would take the json property name as both the relationship type\nand the destination node label.\n\nThese mappings are quite simple and have some limitations:\n\n- Renaming is global, so you can't map \"friends\" one way at the root and another way somewhere else.\n- Renaming is static; there's no way to have the label name be the result of a function, for example.\n\nI don't recommend you go too far with these mappings, they're intended to be quite straightforward and simple.  If you need more complex mappings, you might consider using something like the json-mapper module to massage your JSON data before importing it into \nneo4j.\n\n## Keys\n\nFor using the `--merge` operation, the program needs to know what the node keys are.\nThis is specified in the mapping file like this:\n\n```\n  \"keys\": {\n    \"Tweet\": \"id_str\",\n    \"User\": \"screen_name\"\n  }\n```\n\nConsult tweet-mapping.json in samples for an example.\n\nThis means that when merging every tweet, duplicates by `id_str` will not be created.\n\n## How to use\n\n1. Clone this repository: `git clone https://github.com/hwndept/node-seed`\n2. Remove .git directory\n3. Update package.json\n  - set \"name\"\n  - set \"version\"(0.0.0 by default)\n  - set \"description\"\n  - set \"author\"\n  - set \"license\"\n  - set right \"keywords\" or remove this section\n  - set your \"repository\" or remove this section\n  - set \"bugs\" or remove this section\n  - set \"homepage\" or remove this section\n4. Update README.md\n5. Update .travis.yml to use Travis as CI or remove it.\n  **repo_token** used in config is the codeclimate's token.\n  Every build on travis will report code coverage value to codeclimate.\n\n## What are included\n\n- Code linter - [eslint][eslint-url];\n- Test runner - [mocha][mocha-url];\n- Test coverage checker - [istanbul][istanbul-url];\n- Task manager - [gulp][gulp-url];\n- Pre-commit hook;\n- JsDoc generation - [jsdoc][jsdoc-url];\n- ES6 Support([ECMA-262, Edition 5][ecma-262-edition-5-url]) - [babel][babel-url];\n- Codeclimate integration [codeclimate][codeclimate-url];\n- TravisCI integration [travis-ci][travis-ci-url];\n- Editor Config [editorconfig][editor-config-url];\n- List all available tasks using `gulp help` command;\n\n## Linting\n\n```bash\ngulp lint\n```\n\nCode that will be validated:\n\n- all **\\*.js** files in **src** folder\n- all **\\*.js** files in **test** folder\n- **gulpfile.js**\n\n## Running tests and generating code coverage report\n\n```bash\ngulp test\n```\n\nTest cases stored in files **test/\\*\\*/\\*.test.js** will be run only\n\nCoverage reports will be generated and stored in folder **.build/coverage**\n\n## Generating jsdoc\n\n```bash\ngulp jsdoc\n```\n\nDocumentation will be generated for **\\*.js** files from **src** folder and stored in folder **.build/jsdoc**\n\n## Compiling code - ES6 Support\n\nSince **nodejs** doesn't fully support all ES6 features source code should be compiled.\n\n```bash\ngulp compile\n```\n\nSource code in **src** folder will be compiled and stored in folder **.build/source**\n\n## Running all tasks\n\n```bash\ngulp\n# or\ngulp build\n```\n\n## Pre-commit hook\n\nThis hook is invoked by **git commit**, and can be bypassed with **--no-verify** option.\n\nThe task **gulp build** will be run automatically.\n\n## Printing all available tasks and theirs arguments\n\n```bash\ngulp help\n```\n\n## Directory Layout\n\n```\n  .build/                  --\u003e build results\n    coverage              --\u003e code coverage reports\n    jsdoc                 --\u003e documentation generated for source code\n    source                --\u003e copy of the project but with transpiled code\n  config/\n    confih.yml            --\u003e application configuration file\n  src/                    --\u003e source files for the application\n    services/\n      config.js           --\u003e configuration module\n    hello.js              --\u003e added just for an example\n  test/                   --\u003e test files for the application\n    integration/          --\u003e integration tests\n    unit/                 --\u003e unit tests\n    .eslintrc             --\u003e configuration file for eslint; these rules\n                              will be applied for files in this folder\n                              only; created because test cases contain\n                              global functions which exports by\n                              mocha(describe, it, beforeEach, etc)\n  .codeclimate.yml        --\u003e configuration file for codeclimate\n  .editorconfig           --\u003e configuration file for code editors to keep style\n  .eslintrc               --\u003e configuration file for eslint\n  .travis.yml             --\u003e configuration file for travis-ci\n  gulpfile.js             --\u003e list of all gulp tasks\n```\n\n[project-travis-ci-image]: https://travis-ci.org/hwndept/node-seed.svg?branch=master\n[project-travis-ci-url]: https://travis-ci.org/hwndept/node-seed\n[project-codeclimate-image]: https://codeclimate.com/github/hwndept/node-seed/badges/gpa.svg\n[project-codeclimate-url]: https://codeclimate.com/github/hwndept/node-seed\n[project-codeclimate-coverage-image]: https://codeclimate.com/github/hwndept/node-seed/badges/coverage.svg\n[project-codeclimate-coverage-url]: https://codeclimate.com/github/hwndept/node-seed/coverage\n[project-npm-version]: https://img.shields.io/npm/v/node-seed.svg\n[project-npm-version-url]: https://www.npmjs.com/package/node-seed\n[project-npm-dependencies]: https://david-dm.org/hwndept/node-seed/status.svg\n[project-npm-dependencies-url]: https://david-dm.org/hwndept/node-seed\n[project-npm-dev-dependencies]: https://david-dm.org/hwndept/node-seed/dev-status.svg\n[project-npm-dev-dependencies-url]: https://david-dm.org/hwndept/node-seed#info=devDependencies\u0026view=table\n[eslint-url]: http://eslint.org\n[mocha-url]: http://mochajs.org/\n[istanbul-url]: https://github.com/gotwarlost/istanbul/\n[gulp-url]: http://gulpjs.com/\n[jsdoc-url]: http://usejsdoc.org/\n[ecma-262-edition-5-url]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf\n[babel-url]: https://babeljs.io/\n[codeclimate-url]: https://codeclimate.com/\n[travis-ci-url]: https://travis-ci.org/\n[editor-config-url]: http://editorconfig.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxious%2Fjson2neo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxious%2Fjson2neo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxious%2Fjson2neo/lists"}