{"id":17543612,"url":"https://github.com/xkcoding/simple-json","last_synced_at":"2025-07-22T00:33:30.234Z","repository":{"id":46580084,"uuid":"331271304","full_name":"xkcoding/simple-json","owner":"xkcoding","description":"抽取一个简单 JSON 的通用接口，底层实现根据具体引入依赖指定。","archived":false,"fork":false,"pushed_at":"2023-02-26T15:19:19.000Z","size":32,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-04T00:03:36.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xkcoding.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":"2021-01-20T10:28:42.000Z","updated_at":"2023-04-10T11:12:42.000Z","dependencies_parsed_at":"2025-03-06T21:43:01.780Z","dependency_job_id":null,"html_url":"https://github.com/xkcoding/simple-json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xkcoding/simple-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xkcoding","download_url":"https://codeload.github.com/xkcoding/simple-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-json/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266404942,"owners_count":23923496,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-10-21T00:25:00.367Z","updated_at":"2025-07-22T00:33:30.203Z","avatar_url":"https://github.com/xkcoding.png","language":"Java","readme":"\u003ch1 align=\"center\"\u003e\u003ca href=\"https://github.com/xkcoding/simple-json\" target=\"_blank\"\u003eSimple-JSON\u003c/a\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.com/xkcoding/simple-json\" target=\"_blank\"\u003e\u003cimg alt=\"Travis-CI\" src=\"https://travis-ci.com/xkcoding/simple-json.svg?branch=master\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://search.maven.org/artifact/com.xkcoding.http/simple-json\" target=\"_blank\"\u003e\u003cimg alt=\"MAVEN\" src=\"https://img.shields.io/maven-central/v/com.xkcoding.json/simple-json.svg?color=brightgreen\u0026label=Maven%20Central\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://xkcoding.com\" target=\"_blank\"\u003e\u003cimg alt=\"author\" src=\"https://img.shields.io/badge/author-Yangkai.Shen-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.oracle.com/technetwork/java/javase/downloads/index.html\" target=\"_blank\"\u003e\u003cimg alt=\"JDK\" src=\"https://img.shields.io/badge/JDK-1.8.0_162-orange.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/xkcoding/simple-json/blob/master/LICENSE\" target=\"_blank\"\u003e\u003cimg alt=\"LICENSE\" src=\"https://img.shields.io/github/license/xkcoding/simple-json.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 简介\n\n\u003e 抽取一个简单 JSON 的通用接口，底层实现根据具体引入依赖指定。\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.xkcoding.json\u003c/groupId\u003e\n  \u003cartifactId\u003esimple-json\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 特点\n\n- 默认会按照下面的优先级自行寻找底层实现，`jackson -\u003e fastjson -\u003e gson -\u003e hutool-json`\n- 也可以自行实现 `com.xkcoding.json.support.JsonAdapter` 接口，通过 `JsonUtil.setJsonAdapter(new MyJsonImpl())` 设置进来\n\n```java\nJsonUtil.setConfig(JsonConfig.builder().dateFormat(\"yyyy-MM-dd HH:mm:ss\").build());\n  String jsonStr=JsonUtil.toJsonString(obj);\n  System.out.println(jsonStr);\n\n  User user=JsonUtil.toBean(jsonStr,User.class);\n  System.out.println(user);\n\n  Map map=JsonUtil.toBean(jsonStr,Map.class);\n  System.out.println(map);\n\n  Kv kv=JsonUtil.parseKv(jsonStr);\n```\n\n## TODO\n\n- [x] ~~抽取不同实现的 JSON 序列化/反序列配置~~\n- [x] ~~优化KV体验~~(感谢[@亚东](https://github.com/zhangyd-c)的 [PR#1](https://github.com/xkcoding/simple-json/pull/1))\n- [x] ~~支持 List 转化~~(感谢 [@青木](https://github.com/StringKe) 的 [PR#2](https://github.com/xkcoding/simple-json/pull/2))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkcoding%2Fsimple-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxkcoding%2Fsimple-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkcoding%2Fsimple-json/lists"}