{"id":23651287,"url":"https://github.com/meowzz95/ezjson","last_synced_at":"2025-09-01T01:32:15.867Z","repository":{"id":144337845,"uuid":"191713607","full_name":"Meowzz95/ezjson","owner":"Meowzz95","description":"Read JSON in Go without binding it into a struct","archived":false,"fork":false,"pushed_at":"2019-06-21T02:46:44.000Z","size":28,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T07:05:11.484Z","etag":null,"topics":["go","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/Meowzz95.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":"2019-06-13T07:32:04.000Z","updated_at":"2021-10-15T19:52:58.000Z","dependencies_parsed_at":"2024-05-23T04:29:44.622Z","dependency_job_id":null,"html_url":"https://github.com/Meowzz95/ezjson","commit_stats":null,"previous_names":["meowzz95/easyjson"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Meowzz95/ezjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meowzz95%2Fezjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meowzz95%2Fezjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meowzz95%2Fezjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meowzz95%2Fezjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meowzz95","download_url":"https://codeload.github.com/Meowzz95/ezjson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meowzz95%2Fezjson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273064340,"owners_count":25039259,"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-31T02:00:09.071Z","response_time":79,"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","golang","json"],"created_at":"2024-12-28T16:26:24.341Z","updated_at":"2025-09-01T01:32:15.592Z","avatar_url":"https://github.com/Meowzz95.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/Meowzz95/ezjson.svg?style=shield)](https://circleci.com/gh/Meowzz95/ezjson)\n[![Coverage Status](https://coveralls.io/repos/github/Meowzz95/ezjson/badge.svg?branch=master)](https://coveralls.io/github/Meowzz95/ezjson?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/Meowzz95/ezjson)](https://goreportcard.com/report/github.com/Meowzz95/ezjson)\n# Easy JSON\n\nMiss the way you easily get data from JSON objects? EasyJSON gives you a easier interface to read data from JSON objects. No more messy `map[string]interface{}` from `json.Unmarshal()`\n\n# Install\n\n```\ngo get -u github.com/Meowzz95/ezjson\n```\n\n# API (with error returned, for safe operation)\n\n## Init\n```go\njsonMapper:=NewJsonMapper(jsonStr)\njsonPart,err:=jsonMapper.GetJsonPart()\n```\n\nor easier\n\n```go\njsonPart, err := ezjson.NewJsonMapper(jsonString).GetJsonPart()\n```\n\n`JsonPart` will be your good friend to read data.\n\n## Read data\n\nThere are 5 types of data you can get out of a `JsonPart`, namely `bool, float64, string, JsonArray, JsonPart`.\n\nCurrently `JsonArray` is under development.\n\nUse this JSON as an example:\n\n```json\n{\n    \"Status\": \"SUCCESS\",\n    \"Err\": null,\n    \"Info\": \"\",\n    \"Price\": 25.1,\n    \"IsHigh\": true,\n    \"Payload\": {\n        \"ID\": 14,\n        \"CreatedAt\": \"2019-06-13T10:28:42.396549+08:00\",\n        \"UpdatedAt\": \"2019-06-13T10:28:42.396549+08:00\",\n        \"DeletedAt\": null,\n        \"Key\": \"test_ke11111y\",\n        \"Value\": \"test_value22222\"\n    }\n}\n```\n\n### Get Number\n\nAll numbers are stored in `float64`\n\n```go\nprice, err:=jsonPart.GetFloat64(\"Price\")\n```\nYou get 25.1 saved in `price`\n\nA special version of `GetFloat64()` is `GetFloat64Or(key string, defaultValue float64)`\n\nIf key does not exist or the key does not have a number type, `defaultValue` is returned. No error is returned.\n\n\n### Get Boolean\n\nSimilar to get number, just use\n```go\njsonPart.GetBoolean(\"IsHigh\")\n```\n\n### Get String\n\nSimilar to get number, just use\n```go\nGetString(key string)\n```\n\nA special version of `GetString()` is `GetStringCasted(key string)`, this method will return the data in `string` no matter what the underlying data type is.\n\n\n### Get Part\n\nGet a nested object\n\n```go\ninnerPart, _:=jsonPart.GetPart(\"Payload\")\nv,_:=innerPart.GetFloat64(\"ID\")\n```\n\nAnd you can perform `Getxxx` on the nested object too.\n\n\n# API (**without** error returned, for cleaner API)\n\nRefer to the APIs above... Here are the `...F()` APIs\n\nBTW, `F` stands for force\n\nIn this set of APIs, error can be retrieved from `JsonPart#Error()`\n\nZero value is returned if error occured.\n\n```go\nGetFloat64F()\nGetPartF()\nGetStringF()\nGetBooleanF()\nGetStringCastedF()\n```\n\n\n# Other\n\nPRs are super welcome, please help a newbie :)\n\n## TODO\n- JsonArray support\n- Chaining API (kind of achieved for the GetXXXF() APIs)\n\n## License\n\nMIT\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowzz95%2Fezjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeowzz95%2Fezjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowzz95%2Fezjson/lists"}