{"id":17958305,"url":"https://github.com/sheerun/yson","last_synced_at":"2025-08-16T08:32:50.371Z","repository":{"id":57547008,"uuid":"96161667","full_name":"sheerun/yson","owner":"sheerun","description":"Zero-allocation, human-friendly JSON library for Go","archived":false,"fork":false,"pushed_at":"2017-08-22T01:37:11.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T09:44:46.240Z","etag":null,"topics":["go-lang","json","utilities"],"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/sheerun.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}},"created_at":"2017-07-04T01:00:49.000Z","updated_at":"2021-10-01T08:43:52.000Z","dependencies_parsed_at":"2022-09-05T12:30:56.701Z","dependency_job_id":null,"html_url":"https://github.com/sheerun/yson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sheerun/yson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fyson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fyson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fyson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fyson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheerun","download_url":"https://codeload.github.com/sheerun/yson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fyson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270686171,"owners_count":24628187,"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-08-16T02:00:11.002Z","response_time":91,"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":["go-lang","json","utilities"],"created_at":"2024-10-29T10:59:22.645Z","updated_at":"2025-08-16T08:32:50.070Z","avatar_url":"https://github.com/sheerun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yson [![CircleCI](https://circleci.com/gh/sheerun/yson.svg?style=svg)](https://circleci.com/gh/sheerun/yson) [![Go Report Card](https://goreportcard.com/badge/github.com/sheerun/yson)](https://goreportcard.com/report/github.com/sheerun/yson) [![GoDoc](https://godoc.org/github.com/sheerun/yson?status.svg)](http://godoc.org/github.com/sheerun/yson)\n\nZero-allocation, human-friendly JSON library for Go :cake:\n\nStatus: experimental (API is not stable yet)\n\n## Usage\n\nHere's more advanced example:\n\n```go\nimport \"github.com/sheerun/yson\"\n\njson := byte[](`{\n  \"humans\": {\n    \"Adam\": {\n      \"happy\": true,\n      \"age\": 9\n    },\n    \"John\": {\n      \"happy\": false,\n      \"age\": 12\n    }\n  }\n}`)\n\nyson.EachValue(yson.Get(json, \"humans\"), func(value []byte) {\n  fmt.Printf(\"%s \", yson.Get(value, \"age\"))\n})\n\n// Output: 9 12\n```\n\n\n## API\n\nYson functions accept JSON is raw `byte[]` form. Most of them don't allocate memory but just return slices of it.\n\n### yson.Get\n\nGets a value from JSON object. Can accept multiple keys. Returns `nil` on any incorrect input.\n\n```go\njson := byte[](`{\n  \"Adam\": { \"age\": 9 },\n  \"John\": { \"age\": 12 }\n}`)\n\nif age := yson.Get(json, \"Adam\", \"age\"); age != nil {\n  fmt.Printf(\"%s\", age)\n}\n// Output: 9\n```\n\n### yson.EachKey\n\nIterates over JSON keys. Does nothing on any incorrect input (including `nil`).\n\n```go\njson := byte[](`{ \"Adam\": 9, \"John\": 12 }`)\n\nyson.EachKey(json, func(key []byte) {\n  fmt.Printf(\"%s \", key)\n})\n\n// Output: Adam John\n```\n\n### yson.EachValue\n\nIterates over JSON values. Does nothing on any incorrect input (including `nil`).\n\n```go\njson := byte[](`{ \"Adam\": 9, \"John\": 12 }`)\n\nyson.EachValue(json, func(value []byte) {\n  fmt.Printf(\"%s \", value)\n})\n\n// Output: 9 12\n```\n\n### yson.EachPair\n\nIterates over JSON keys and values. Does nothing on any incorrect input (including `nil`).\n\n```go\njson := byte[](`{ \"Adam\": 9, \"John\": 12 }`)\n\nyson.EachPair(json, func(key []byte, value []byte) {\n  fmt.Printf(\"%s=%s \", key, value)\n})\n\n// Output: Adam=9 John=12\n```\n\n### yson.Load\n\nParses JSON value to go-lang structure or value.\n\n```go\nvar ages map[string]int\njson := byte[](`{ \"Adam\": 9, \"John\": 12 }`)\n\nyson.Load(json, ages)\nfmt.Printf(\"%s %s\", ages[\"Adam\"], ages[\"John\"])\n// Output: 9 12\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheerun%2Fyson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheerun%2Fyson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheerun%2Fyson/lists"}