{"id":16874404,"url":"https://github.com/xiaost/jsonport","last_synced_at":"2025-04-11T11:24:35.741Z","repository":{"id":35688130,"uuid":"39964707","full_name":"xiaost/jsonport","owner":"xiaost","description":"a simple and high performance json reader without pain","archived":false,"fork":false,"pushed_at":"2020-04-02T15:32:07.000Z","size":24,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T07:51:07.561Z","etag":null,"topics":["golang","json"],"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/xiaost.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":"2015-07-30T17:57:59.000Z","updated_at":"2024-06-14T15:27:45.000Z","dependencies_parsed_at":"2022-09-02T00:10:13.895Z","dependency_job_id":null,"html_url":"https://github.com/xiaost/jsonport","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/xiaost%2Fjsonport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaost%2Fjsonport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaost%2Fjsonport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaost%2Fjsonport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaost","download_url":"https://codeload.github.com/xiaost/jsonport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248382661,"owners_count":21094561,"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":["golang","json"],"created_at":"2024-10-13T15:32:35.198Z","updated_at":"2025-04-11T11:24:35.718Z","avatar_url":"https://github.com/xiaost.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\njsonport [![GoDoc](https://godoc.org/github.com/xiaost/jsonport?status.png)](https://godoc.org/github.com/xiaost/jsonport)\n====\n\njsonport is a simple and high performance golang package for accessing json without pain. features:\n* No reflection.\n* Unmarshal without struct.\n* Unmarshal for the given json path only.\n* 2x faster than encoding/json.\n\nIt is inspired by [jmoiron/jsonq](https://github.com/jmoiron/jsonq). Feel free to post issues or PRs, I will reply ASAP :-)\n\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/xiaost/jsonport\"\n)\n\nfunc main() {\n\tjsonstr := `{\n\t\t\"timestamp\": \"1438194274\",\n\t\t\"users\": [{\"id\": 1, \"name\": \"Tom\"}, {\"id\": 2, \"name\": \"Peter\"}],\n\t\t\"keywords\": [\"golang\", \"json\"],\n\t\t\"status\": 1\n\t}`\n\tj, _ := jsonport.Unmarshal([]byte(jsonstr))\n\n\tfmt.Println(j.GetString(\"users\", 0, \"name\"))             // Tom, nil\n\tfmt.Println(j.Get(\"keywords\").StringArray())             // [golang json], nil\n\tfmt.Println(j.Get(\"users\").EachOf(\"name\").StringArray()) // [Tom Peter],  nil\n\n\t// try parse STRING as NUMBER\n\tfmt.Println(j.Get(\"timestamp\").Int()) // 0, type mismatch: expected NUMBER, found STRING\n\tj.StringAsNumber()\n\tfmt.Println(j.Get(\"timestamp\").Int()) // 1438194274, nil\n\n\t// convert NUMBER, STRING, ARRAY and OBJECT type to BOOL\n\tfmt.Println(j.GetBool(\"status\")) // false, type mismatch: expected BOOL, found NUMBER\n\tj.AllAsBool()\n\tfmt.Println(j.GetBool(\"status\")) // true, nil\n\n\t// using Unmarshal with path which can speed up json decode\n\tj, _ = jsonport.Unmarshal([]byte(jsonstr), \"users\", 1, \"name\")\n\tfmt.Println(j.String()) // Peter, nil\n}\n```\n\nFor more information on getting started with `jsonport` [check out the doc](https://godoc.org/github.com/xiaost/jsonport)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaost%2Fjsonport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaost%2Fjsonport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaost%2Fjsonport/lists"}