{"id":27135543,"url":"https://github.com/go-universal/jsoner","last_synced_at":"2026-04-24T16:06:22.905Z","repository":{"id":286604509,"uuid":"961927922","full_name":"go-universal/jsoner","owner":"go-universal","description":"Flexible JSON encoder for Go.","archived":false,"fork":false,"pushed_at":"2025-04-07T11:55:54.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T00:08:31.985Z","etag":null,"topics":["golang","json","json-marshalling"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-universal.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":"2025-04-07T11:41:37.000Z","updated_at":"2025-04-08T09:31:14.000Z","dependencies_parsed_at":"2025-04-07T12:49:07.588Z","dependency_job_id":null,"html_url":"https://github.com/go-universal/jsoner","commit_stats":null,"previous_names":["go-universal/jsoner"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-universal%2Fjsoner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-universal%2Fjsoner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-universal%2Fjsoner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-universal%2Fjsoner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-universal","download_url":"https://codeload.github.com/go-universal/jsoner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131317,"owners_count":21052819,"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","json-marshalling"],"created_at":"2025-04-08T01:48:36.212Z","updated_at":"2026-04-24T16:06:17.882Z","avatar_url":"https://github.com/go-universal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jsoner (Extended GoLang JSON Marshal)\n\n![GitHub Tag](https://img.shields.io/github/v/tag/go-universal/jsoner?sort=semver\u0026label=version)\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-universal/jsoner.svg)](https://pkg.go.dev/github.com/go-universal/jsoner)\n[![License](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/go-universal/jsoner/blob/main/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-universal/jsoner)](https://goreportcard.com/report/github.com/go-universal/jsoner)\n![Contributors](https://img.shields.io/github/contributors/go-universal/jsoner)\n![Issues](https://img.shields.io/github/issues/go-universal/jsoner)\n\n`jsoner` is a Go package that provides utilities for marshaling Go structs into JSON with advanced filtering capabilities. It allows you to exclude specific fields or nested paths from the JSON output.\n\n## Installation\n\nTo install the package, run:\n\n```bash\ngo get github.com/go-universal/jsoner\n```\n\n## Usage\n\nImport the package in your Go code:\n\n```go\nimport \"github.com/go-universal/jsoner\"\n```\n\n### Marshal\n\nConverts the input value (`v`) into JSON format, excluding specified fields or paths.\n\n```go\nfunc Marshal(v any, exclude ...string) ([]byte, error)\n```\n\n```go\ntype Book struct {\n    Title string\n    ISBN  string `json:\"isbn\"`\n}\n\ntype Author struct {\n    Name   string `json:\"name\"`\n    Family string `json:\"family\"`\n    Books  []Book `json:\"author_books\"`\n}\n\nauthor := Author{\n    Name:   \"John\",\n    Family: \"Doe\",\n    Books: []Book{\n        {Title: \"Book 1\", ISBN: \"12345\"},\n        {Title: \"Book 2\", ISBN: \"67890\"},\n    },\n}\n\njsonData, err := jsoner.Marshal(author, \"family\", \"author_books.isbn\")\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(string(jsonData))\n// Output: {\"name\":\"John\",\"author_books\":[{\"Title\":\"Book 1\"},{\"Title\":\"Book 2\"}]}\n```\n\n### MarshalIndent\n\nConverts the input value (`v`) into indented JSON format, excluding specified fields or paths.\n\n```go\nfunc MarshalIndent(v any, indent string, exclude ...string) ([]byte, error)\n```\n\n```go\ntype Book struct {\n    Title string\n    ISBN  string `json:\"isbn\"`\n}\n\ntype Author struct {\n    Name   string `json:\"name\"`\n    Family string `json:\"family\"`\n    Books  []Book `json:\"author_books\"`\n}\n\nauthor := Author{\n    Name:   \"John\",\n    Family: \"Doe\",\n    Books: []Book{\n        {Title: \"Book 1\", ISBN: \"12345\"},\n        {Title: \"Book 2\", ISBN: \"67890\"},\n    },\n}\n\njsonData, err := jsoner.MarshalIndent(author, \"  \", \"family\", \"author_books.isbn\")\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(string(jsonData))\n// Output:\n// {\n//   \"name\": \"John\",\n//   \"author_books\": [\n//     {\n//       \"Title\": \"Book 1\"\n//     },\n//     {\n//       \"Title\": \"Book 2\"\n//     }\n//   ]\n// }\n```\n\n## License\n\nThis project is licensed under the ISC License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-universal%2Fjsoner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-universal%2Fjsoner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-universal%2Fjsoner/lists"}