{"id":17176186,"url":"https://github.com/wanglin2/json-tree-view","last_synced_at":"2025-10-15T20:37:36.422Z","repository":{"id":175126604,"uuid":"652537519","full_name":"wanglin2/json-tree-view","owner":"wanglin2","description":"一个简洁的json格式化插件。","archived":false,"fork":false,"pushed_at":"2023-06-14T06:21:29.000Z","size":55,"stargazers_count":16,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T14:51:18.992Z","etag":null,"topics":["json","json-tree","json-tree-view"],"latest_commit_sha":null,"homepage":"https://wanglin2.github.io/json-tree-view/","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/wanglin2.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":"2023-06-12T09:19:28.000Z","updated_at":"2024-12-19T03:55:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"65a7487a-8cd1-452c-8f5d-2057f162ec1e","html_url":"https://github.com/wanglin2/json-tree-view","commit_stats":null,"previous_names":["wanglin2/json-tree-view"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wanglin2/json-tree-view","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2Fjson-tree-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2Fjson-tree-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2Fjson-tree-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2Fjson-tree-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wanglin2","download_url":"https://codeload.github.com/wanglin2/json-tree-view/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2Fjson-tree-view/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279111751,"owners_count":26106098,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["json","json-tree","json-tree-view"],"created_at":"2024-10-14T23:59:29.438Z","updated_at":"2025-10-15T20:37:36.417Z","avatar_url":"https://github.com/wanglin2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json tree view\n\n一个简洁的 json 格式化插件，不依赖任何库和框架。\n\n## 安装\n\n```bash\nnpm i simple-json-tree-view\n```\n\n## 引入\n\n```js\nimport JsonTreeView from 'simple-json-tree-view'\nimport 'simple-json-tree-view/themes/default.css'\n```\n\n## 使用\n\n```js\nnew JsonTreeView({\n  el: '#container'\n})\n```\n\n## 主题\n\n默认提供了两个主题：\n\n亮色：\n\n```js\nimport 'simple-json-tree-view/themes/default.css'\n```\n\n暗色：\n\n```js\nimport 'simple-json-tree-view/themes/oneDarkPro.css'\n```\n\n插件的字体、字号、颜色、间距、展开收起按钮的样式等都可以调整，所有类名都可以通过`default.css`找到，你可以选择覆盖某一部分，也可以整个覆盖，也就是不要引入默认的样式文件，直接使用你重写的样式即可。\n\n## API\n\n### 创建实例\n\n```js\nimport JsonTreeView from 'simple-json-tree-view'\nlet jsonTreeView = new JsonTreeView(options)\n```\n\n### 实例化选项options\n\n一个对象，支持的属性如下：\n\n| 属性  | 说明                               | 类型   | 可选值 | 默认值 |\n| ----- | ---------------------------------- | ------ | ------ | ------ |\n| el | 必传，容器元素，可以传一个选择器，也可以传dom元素 | HTMLElement | —      |  |\n| expandBtnPosition | 展开收起按钮的位置 | String | default（紧贴括号）、left（统一在左侧） | default |\n| showLine | 是否显示竖线 | Boolean | —      | false |\n| showExpandBtn | 是否显示展开收起按钮 | Boolean | —      | true |\n| showHover | 是否显示鼠标滑入的高亮效果 | Boolean | —      | true |\n| showRowNum | 是否显示行数 | Boolean | —      | false |\n| errorSliceNum | 出错位置前后截取的字符串长度 | Number | —      | 20 |\n\n### 实例方法\n\n#### destroy()\n\n销毁。\n\n#### stringify(data)\n\n- data：json字符串，或json对象\n\n渲染json树。\n\n#### unExpandAll()\n\n收起所有。\n\n#### expandAll()\n\n展开所有。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglin2%2Fjson-tree-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwanglin2%2Fjson-tree-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglin2%2Fjson-tree-view/lists"}