{"id":13764108,"url":"https://github.com/rs/formjson","last_synced_at":"2025-07-11T15:34:39.655Z","repository":{"id":29025115,"uuid":"32552406","full_name":"rs/formjson","owner":"rs","description":"Go net/http handler to transparently manage posted JSON","archived":false,"fork":false,"pushed_at":"2015-12-17T09:35:29.000Z","size":4,"stargazers_count":38,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T14:46:47.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-19T23:52:28.000Z","updated_at":"2025-03-04T10:44:24.000Z","dependencies_parsed_at":"2022-08-02T11:50:02.699Z","dependency_job_id":null,"html_url":"https://github.com/rs/formjson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rs/formjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fformjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fformjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fformjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fformjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rs","download_url":"https://codeload.github.com/rs/formjson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2Fformjson/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264841383,"owners_count":23671891,"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":[],"created_at":"2024-08-03T15:01:14.057Z","updated_at":"2025-07-11T15:34:39.611Z","avatar_url":"https://github.com/rs.png","language":"Go","readme":"# Go JSON handler [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/formjson) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/formjson/master/LICENSE) [![build](https://img.shields.io/travis/rs/formjson.svg?style=flat)](https://travis-ci.org/rs/formjson)\n\nFormJSON is a `net/http` handler implementing content negotiation for posted data in order to transparently expose posted JSON as if it was `application/x-www-form-urlencoded`. The posted data is then available using built-in `r.FormValue(\"key\")`'s `http.Request` method.\n\nTo match capabilities of `application/x-www-form-urlencoded`, only single depth JSON object with `string` as keys and values is supported.\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"net/http\"\n    \"fmt\"\n\n    \"github.com/rs/formjson\"\n)\n\nfunc main() {\n    h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        body := fmt.Sprintf(\"Hello %s!\", r.FormValue(\"name\"))\n        w.Write([]byte(body))\n    })\n\n    handler := formjson.Handler(h)\n    http.ListenAndServe(\":8080\", handler)\n}\n```\n\nThen this request:\n\n    curl -H \"Content-Type:application/json\" -d '{\"name\":\"World\"}' :8080\n\nis now equivalent to this one:\n\n    curl -d name=World :8080\n\n## Licenses\n\nAll source code is licensed under the [MIT License](https://raw.github.com/rs/formjson/master/LICENSE).\n","funding_links":[],"categories":["Web Frameworks","中间件","中间件### 中间件","Web框架","XML","Actual middlewares"],"sub_categories":["Middlewares","中间件","版本控制`版本控制相关库`","中間件","Fail injection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fformjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frs%2Fformjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fformjson/lists"}