{"id":14990143,"url":"https://github.com/1602/json-viewer-vanilla","last_synced_at":"2026-01-20T08:33:38.112Z","repository":{"id":240550354,"uuid":"802940465","full_name":"1602/json-viewer-vanilla","owner":"1602","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-03T19:00:13.000Z","size":581,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T10:37:17.567Z","etag":null,"topics":["custom-elements","devtools","json-viewer","vanilla-javascript","webcomponent"],"latest_commit_sha":null,"homepage":"https://1602.github.io/json-viewer-vanilla/?path=/story/jsonviewerwebcomponent--expanded-nodes","language":"TypeScript","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/1602.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-19T17:03:12.000Z","updated_at":"2024-10-03T19:00:17.000Z","dependencies_parsed_at":"2024-05-19T18:24:43.591Z","dependency_job_id":"77d6af52-3ebe-476f-b75d-41555b920990","html_url":"https://github.com/1602/json-viewer-vanilla","commit_stats":null,"previous_names":["1602/json-viewer-vanilla"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1602/json-viewer-vanilla","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1602%2Fjson-viewer-vanilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1602%2Fjson-viewer-vanilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1602%2Fjson-viewer-vanilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1602%2Fjson-viewer-vanilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1602","download_url":"https://codeload.github.com/1602/json-viewer-vanilla/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1602%2Fjson-viewer-vanilla/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28599042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"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":["custom-elements","devtools","json-viewer","vanilla-javascript","webcomponent"],"created_at":"2024-09-24T14:19:34.578Z","updated_at":"2026-01-20T08:33:38.094Z","avatar_url":"https://github.com/1602.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-viewer\n\nThis is a json-viewer custom element (a.k.a. web-component). Nothing fancy, just a copy of devtools json viewer you see in network panel when previewing json response.\n\nHere’s a [demo](https://jsfiddle.net/1602/yh6pozmd/).\n\n## Usage\n\n### HTML\n\nLoad as module, and use\n\n```html\n\u003cscript type=\"module\" src=\"https://unpkg.com/@_1602/json-viewer\"\u003e\u003c/script\u003e\n\u003cjson-viewer value='{\"foo\": \"bar\"}'\u003e\u003c/json-viewer\u003e\n```\n\nCustomize appearance in CSS\n\n```css\njson-viewer {\n  --jv-background-color: #fff;\n  --jv-color: rgb(31, 31, 31);\n  --jv-font-size: 11px;\n  --jv-font-family: monospace;\n  --jv-font-weight: 400;\n  --jv-expand-bullet-color: black;\n  --jv-expand-bullet-width: 14px;\n  --jv-expand-bullet-height: 14px;\n  --jv-key-color: rgb(142, 0, 75);\n  --jv-number-value-color: rgb(8, 66, 160);\n  --jv-bool-value-color: rgb(8, 66, 160);\n  --jv-null-value-color: rgba(31, 31, 31, 0.38);\n  --jv-string-value-color: rgb(220, 54, 46);\n  --jv-focused-node-background: #eee;\n  --jv-hovered-node-background: #eee;\n}\n```\n\nTo change toggle icon (‣):\n\n```css\njson-viewer {\n  --expand-bullet-mask-image: url('data:image/svg+xml;utf8,\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\"\u003e\u003cpath d=\"M10.5 6.65 4.9 2.8v7.7\" fill=\"black\"/\u003e\u003c/svg\u003e');\n}\n```\n\n### React+TS\n\nTo use it in react create `declarations.d.ts` with\n\n```typescript\ndeclare namespace JSX {\n  interface IntrinsicElements {\n    'json-viewer': any;\n  }\n}\n```\n\nAnd then use as like this\n\n```jsx\nexport function JsonViewer({ value }: { value: string }) {\n  return \u003cjson-viewer value={value}\u003e\u003c/json-viewer\u003e;\n}\n```\n\n### Vue+Vite\n\nIn vite config, add to `vue()` plugin\n\n```js\nexport default defineConfig({\n  // ...\n  plugins: [\n    vue({\n      template: {\n        compilerOptions: {\n          isCustomElement: (tag) =\u003e ['json-viewer', ...].includes(tag),\n        },\n      },\n    }),\n  ],\n  // ...\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1602%2Fjson-viewer-vanilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1602%2Fjson-viewer-vanilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1602%2Fjson-viewer-vanilla/lists"}