{"id":15393876,"url":"https://github.com/mitchellh/protoc-gen-go-json","last_synced_at":"2025-10-11T05:31:43.163Z","repository":{"id":42364081,"uuid":"200770844","full_name":"mitchellh/protoc-gen-go-json","owner":"mitchellh","description":"Protobuf compiler plugin to generate Go JSON Marshal/Unmarshal implementations for messages using jsonpb.","archived":true,"fork":false,"pushed_at":"2024-03-13T21:04:34.000Z","size":53,"stargazers_count":234,"open_issues_count":6,"forks_count":42,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-10T17:56:53.761Z","etag":null,"topics":["golang","protobuf"],"latest_commit_sha":null,"homepage":"https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc","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/mitchellh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-08-06T03:38:28.000Z","updated_at":"2025-09-25T05:22:22.000Z","dependencies_parsed_at":"2024-06-18T12:38:16.938Z","dependency_job_id":"14cd763b-8677-480b-80d0-a3eec7f44a0a","html_url":"https://github.com/mitchellh/protoc-gen-go-json","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mitchellh/protoc-gen-go-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fprotoc-gen-go-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fprotoc-gen-go-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fprotoc-gen-go-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fprotoc-gen-go-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/protoc-gen-go-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fprotoc-gen-go-json/sbom","scorecard":{"id":650253,"data":{"date":"2025-08-11","repo":{"name":"github.com/mitchellh/protoc-gen-go-json","commit":"49905733154f04e47d685de62c2cc2b72613b69e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":2,"reason":"Found 5/22 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:5","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3372 / GHSA-6wxm-mpqj-6jpf","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T13:19:52.192Z","repository_id":42364081,"created_at":"2025-08-21T13:19:52.192Z","updated_at":"2025-08-21T13:19:52.192Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006320,"owners_count":26084085,"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-10-11T02:00:06.511Z","response_time":55,"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":["golang","protobuf"],"created_at":"2024-10-01T15:20:38.728Z","updated_at":"2025-10-11T05:31:42.926Z","avatar_url":"https://github.com/mitchellh.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# protoc-gen-go-json\n\nThis is a plugin for the Google Protocol Buffers compiler\n[protoc](https://github.com/protocolbuffers/protobuf) that generates\ncode to implement [json.Marshaler](https://golang.org/pkg/encoding/json/#Marshaler)\nand [json.Unmarshaler](https://golang.org/pkg/encoding/json/#Unmarshaler)\nusing [protojson](https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson).\n\nThis enables Go-generated protobuf messages to be embedded directly within\nother structs and encoded with the standard JSON library, since the standard\n`encoding/json` library can't encode certain protobuf messages such as\nthose that contain `oneof` fields.\n\n## Install\n\n```\ngo get github.com/mitchellh/protoc-gen-go-json\n```\n\nAlso required:\n\n- [protoc](https://github.com/google/protobuf)\n- [protoc-gen-go](https://github.com/golang/protobuf)\n\n## Usage\n\nDefine your messages like normal:\n\n```proto\nsyntax = \"proto3\";\n\nmessage Request {\n  oneof kind {\n    string name = 1;\n    int32  code = 2;\n  }\n}\n```\n\nThe example message purposely uses a `oneof` since this won't work by\ndefault with `encoding/json`. Next, generate the code:\n\n```\nprotoc --go_out=. --go-json_out=. request.proto\n```\n\nYour output should contain a file `request.pb.json.go` which contains\nthe implementation of `json.Marshal/Unmarshal` for all your message types.\nYou can then encode your messages using standard `encoding/json`:\n\n```go\nimport \"encoding/json\"\n\n// Marshal\nbs, err := json.Marshal(\u0026Request{\n  Kind: \u0026Kind_Name{\n    Name: \"alice\",\n  },\n}\n\n// Unmarshal\nvar result Request\njson.Unmarshal(bs, \u0026result)\n```\n\n### Options\n\nThe generator supports options you can specify via the command-line:\n\n- `enums_as_ints={bool}` - Render enums as integers instead of strings.\n- `emit_defaults={bool}` - Render fields with zero values.\n- `orig_name={bool}` - Use original (.proto file) name for fields.\n- `allow_unknown={bool}` - Allow messages to contain unknown fields when unmarshaling\n\nIt also includes the \"standard\" options available to all [protogen](https://pkg.go.dev/google.golang.org/protobuf/compiler/protogen?tab=doc)-based plugins:\n\n- `import_path={path}` - Override the import path\n- `paths=source_relative` - Derive the output path from the input path\n- etc.\n\nThese can be set as part of the `--go-json_out` value:\n\n```sh\nprotoc --go-json_opt=emit_defaults=true:.\n```\n\nYou can specify multiple using a `,`:\n\n```sh\nprotoc --go-json_out=enums_as_ints=true,emit_defaults=true:.\n```\n\nAlternatively, you may also specify options using the `--go-json_opt` value:\n\n```sh\nprotoc --go-json_out:. --go-json_opt=emit_defaults=true,enums_as_ints=true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fprotoc-gen-go-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fprotoc-gen-go-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fprotoc-gen-go-json/lists"}