{"id":13694305,"url":"https://github.com/TylerBrock/colorjson","last_synced_at":"2025-05-03T01:32:23.590Z","repository":{"id":49585751,"uuid":"100555940","full_name":"TylerBrock/colorjson","owner":"TylerBrock","description":"Fast Color JSON Marshaller + Pretty Printer for Golang","archived":false,"fork":false,"pushed_at":"2023-02-26T02:36:16.000Z","size":6,"stargazers_count":149,"open_issues_count":5,"forks_count":26,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T07:23:43.579Z","etag":null,"topics":["color","golang","json","marshaller","no-dependencies","pretty-print"],"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/TylerBrock.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}},"created_at":"2017-08-17T03:10:45.000Z","updated_at":"2024-09-09T14:52:26.000Z","dependencies_parsed_at":"2024-01-13T23:08:16.861Z","dependency_job_id":"18ea6e0a-e5b5-4bfd-85f5-486c8d0bdeba","html_url":"https://github.com/TylerBrock/colorjson","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/TylerBrock%2Fcolorjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerBrock%2Fcolorjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerBrock%2Fcolorjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerBrock%2Fcolorjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TylerBrock","download_url":"https://codeload.github.com/TylerBrock/colorjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224346486,"owners_count":17296221,"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":["color","golang","json","marshaller","no-dependencies","pretty-print"],"created_at":"2024-08-02T17:01:28.975Z","updated_at":"2024-11-12T20:31:58.466Z","avatar_url":"https://github.com/TylerBrock.png","language":"Go","funding_links":[],"categories":["开源类库","Open source library"],"sub_categories":["JSON"],"readme":"ColorJSON: The Fast Color JSON Marshaller for Go\n================================================\n![ColorJSON Output](https://i.imgur.com/pLtCXhb.png)\nWhat is this?\n-------------\n\nThis package is based heavily on hokaccha/go-prettyjson but has some noticible differences:\n - Over twice as fast (recursive descent serialization uses buffer instead of string concatenation)\n   ```\n   BenchmarkColorJSONMarshall-4     500000      2498 ns/op\n   BenchmarkPrettyJSON-4            200000      6145 ns/op\n   ```\n - more customizable (ability to have zero indent, print raw json strings, etc...)\n - better defaults (less bold colors)\n\nColorJSON was built in order to produce fast beautiful colorized JSON output for [Saw](http://github.com/TylerBrock/saw).\n\nInstallation\n------------\n\n```sh\ngo get -u github.com/TylerBrock/colorjson\n```\n\nUsage\n-----\n\nSetup\n\n```go\nimport \"github.com/TylerBrock/colorjson\"\n\nstr := `{\n  \"str\": \"foo\",\n  \"num\": 100,\n  \"bool\": false,\n  \"null\": null,\n  \"array\": [\"foo\", \"bar\", \"baz\"],\n  \"obj\": { \"a\": 1, \"b\": 2 }\n}`\n\n// Create an intersting JSON object to marshal in a pretty format\nvar obj map[string]interface{}\njson.Unmarshal([]byte(str), \u0026obj)\n```\n\nVanilla Usage\n\n```go\ns, _ := colorjson.Marshal(obj)\nfmt.Println(string(s))\n```\n\nCustomization (Custom Indent)\n```go\nf := colorjson.NewFormatter()\nf.Indent = 2\n\ns, _ := f.Marshal(v)\nfmt.Println(string(s))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTylerBrock%2Fcolorjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTylerBrock%2Fcolorjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTylerBrock%2Fcolorjson/lists"}