{"id":13413753,"url":"https://github.com/nikolaydubina/jsonl-graph","last_synced_at":"2025-04-13T15:12:20.183Z","repository":{"id":46011121,"uuid":"380432840","full_name":"nikolaydubina/jsonl-graph","owner":"nikolaydubina","description":"🏝 JSONL Graph Tools","archived":false,"fork":false,"pushed_at":"2024-08-22T09:05:53.000Z","size":22968,"stargazers_count":75,"open_issues_count":5,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T15:12:15.066Z","etag":null,"topics":["cli","data-visualization","go","graph","json"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nikolaydubina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"nikolaydubina"}},"created_at":"2021-06-26T06:37:03.000Z","updated_at":"2025-03-16T16:08:54.000Z","dependencies_parsed_at":"2024-10-22T22:57:14.113Z","dependency_job_id":null,"html_url":"https://github.com/nikolaydubina/jsonl-graph","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fjsonl-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fjsonl-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fjsonl-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikolaydubina%2Fjsonl-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikolaydubina","download_url":"https://codeload.github.com/nikolaydubina/jsonl-graph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732488,"owners_count":21152852,"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":["cli","data-visualization","go","graph","json"],"created_at":"2024-07-30T20:01:48.213Z","updated_at":"2025-04-13T15:12:20.162Z","avatar_url":"https://github.com/nikolaydubina.png","language":"Go","funding_links":["https://github.com/sponsors/nikolaydubina"],"categories":["Science and Data Analysis","科学与数据分析","Relational Databases","Go"],"sub_categories":["HTTP Clients","HTTP客户端"],"readme":"# JSONL Graph Tools\n\n\u003e Convenient to use with `jq`\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/nikolaydubina/jsonl-graph.svg)](https://pkg.go.dev/github.com/nikolaydubina/jsonl-graph)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nikolaydubina/jsonl-graph)](https://goreportcard.com/report/github.com/nikolaydubina/jsonl-graph)\n[![codecov](https://codecov.io/gh/nikolaydubina/jsonl-graph/branch/main/graph/badge.svg?token=gU3DUNXgX3)](https://codecov.io/gh/nikolaydubina/jsonl-graph)\n[![Tests](https://github.com/nikolaydubina/jsonl-graph/workflows/Tests/badge.svg)](https://github.com/nikolaydubina/jsonl-graph/actions)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#science-and-data-analysis)\n[![go-recipes](https://raw.githubusercontent.com/nikolaydubina/go-recipes/main/badge.svg?raw=true)](https://github.com/nikolaydubina/go-recipes)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/nikolaydubina/jsonl-graph/badge)](https://securityscorecards.dev/viewer/?uri=github.com/nikolaydubina/jsonl-graph)\n\n```\n# get https://graphviz.org/download/ \n$ go install github.com/nikolaydubina/jsonl-graph@latest\n```\n\nWhat is JSONL graph? Node has `id`. Edge has `from` and `to`.\n```\n{\n    \"id\": \"github.com/gin-gonic/gin\",\n    \"can_get_github\": true,\n    \"github_url\": \"https://github.com/gin-gonic/gin\",\n    \"git_last_commit\": \"2021-04-21\",\n    \"git_num_contributors\": 321,\n    ...\n}\n...\n{\n    \"from\": \"github.com/gin-gonic/gin\",\n    \"to\": \"golang.org/x/tools\",\n    ...\n}\n```\n\n## Examples\n\nKubernetes Pod Owners\n\n```bash\n$ kubectl get pods -o json | jq '.items[] | {to: (.kind + \":\" + .metadata.name), from: (.metadata.ownerReferences[].kind + \":\" + .metadata.ownerReferences[].name)}' | jsonl-graph | dot -Tsvg \u003e k8s_pod_owners.svg\n```\n\n![k8s_pod_owners](./testdata/k8s_pod_owners.svg)\n\nLarge nodes and color scheme\n```bash\n$ cat '\n{\"id\":\"github.com/gin-gonic/gin\",\"can_get_git\":true, ... }\n{\"id\":\"github.com/gin-contrib/sse\",\"can_get_git\":true,\"can_run_tests\":true ... }\n...\n{\"from\":\"github.com/gin-gonic/gin\",\"to\":\"golang.org/x/tools\"}\n{\"from\":\"github.com/gin-gonic/gin\",\"to\":\"github.com/go-playground/validator/v10\"}\n' | jsonl-graph -color-scheme=file://$PWD/testdata/colors.json | dot -Tsvg \u003e colored.svg\n```\n![gin-color](./testdata/gin_color.svg)\n\nSmall nodes or only edges\n```bash\n$ cat '\n{\"from\":\"github.com/nikolaydubina/jsonl-graph/graph\",\"to\":\"bufio\"}\n{\"from\":\"github.com/nikolaydubina/jsonl-graph/graph\",\"to\":\"bytes\"}\n{\"from\":\"github.com/nikolaydubina/jsonl-graph/graph\",\"to\":\"encoding/json\"}\n{\"from\":\"github.com/nikolaydubina/jsonl-graph/graph\",\"to\":\"errors\"}\n{\"from\":\"github.com/nikolaydubina/jsonl-graph/graph\",\"to\":\"fmt\"}\n...\n' | jsonl-graph | dot -Tsvg \u003e small.svg\n```\n\n![small](./testdata/small.svg)\n\nAll Kubernetes Pod Owners with details\n\n```bash\n# add edges\n$ kubectl get pods -o json | jq '.items[] | {to: .metadata.name, from: .metadata.ownerReferences[].name}' \u003e k8s_pod_owners_details.jsonl\n# add node details\n$ kubectl get rs -o json | jq '.items[] | .id += .metadata.name' \u003e\u003e k8s_pod_owners_details.jsonl\n$ kubectl get pods -o json | jq '.items[] | .id += .metadata.name' \u003e\u003e k8s_pod_owners_details.jsonl\n# flatten objects and render\n$ cat k8s_pod_owners_details.jsonl | jq '. as $in | reduce leaf_paths as $path ({}; . + { ($path | map(tostring) | join(\".\")): $in | getpath($path) })' | jsonl-graph | dot -Tsvg \u003e k8s_pod_owners.svg\n```\n\n![k8s_pod_owners_details](./testdata/k8s_pod_owners_details.svg)\n\n## Rendering\n\nCurrently only Graphviz is supported.\nFollow progress of native Go graph rendering in [github.com/nikolaydubina/go-graph-layout](https://github.com/nikolaydubina/go-graph-layout). Once it is ready, it will be integrated into this project.\n\n## Generate Docs\n\n```bash\ncat testdata/gin.jsonl | ./jsonl-graph \u003e testdata/gin_nocolor.dot\ncat testdata/gin_nocolor.dot | dot -Tsvg \u003e testdata/gin_nocolor.svg\ncat testdata/gin.jsonl | ./jsonl-graph -color-scheme=file://$$PWD/testdata/colors.json \u003e testdata/gin_color.dot\ncat testdata/gin_color.dot | dot -Tsvg \u003e testdata/gin_color.svg\ncat testdata/small.jsonl | ./jsonl-graph \u003e testdata/small.dot\ncat testdata/small.dot | dot -Tsvg \u003e testdata/small.svg\ncat testdata/small.jsonl | ./jsonl-graph -lr \u003e testdata/small_lr.dot\ncat testdata/small_lr.dot | dot -Tsvg \u003e testdata/small_lr.svg\ncat testdata/small.jsonl | ./jsonl-graph -tb \u003e testdata/small_tb.dot\ncat testdata/small_tb.dot | dot -Tsvg \u003e testdata/small_tb.svg\ncat testdata/k8s_pod_owners.jsonl | ./jsonl-graph \u003e testdata/k8s_pod_owners.dot\ncat testdata/k8s_pod_owners.dot | dot -Tsvg \u003e testdata/k8s_pod_owners.svg\ncat testdata/k8s_pod_owners_details.jsonl | ./jsonl-graph \u003e testdata/k8s_pod_owners_details.dot\ncat testdata/k8s_pod_owners_details.dot | dot -Tsvg \u003e testdata/k8s_pod_owners_details.svg\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolaydubina%2Fjsonl-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikolaydubina%2Fjsonl-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikolaydubina%2Fjsonl-graph/lists"}