{"id":21222978,"url":"https://github.com/imp/reqwest-pretty-json","last_synced_at":"2025-06-23T12:33:22.973Z","repository":{"id":230718137,"uuid":"779999461","full_name":"imp/reqwest-pretty-json","owner":"imp","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-31T12:44:36.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T01:32:51.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-31T12:09:15.000Z","updated_at":"2024-03-31T12:09:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"1c7a2ae7-cbbb-499d-b11d-ad90995659f4","html_url":"https://github.com/imp/reqwest-pretty-json","commit_stats":null,"previous_names":["imp/reqwest-pretty-json"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/imp/reqwest-pretty-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imp%2Freqwest-pretty-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imp%2Freqwest-pretty-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imp%2Freqwest-pretty-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imp%2Freqwest-pretty-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imp","download_url":"https://codeload.github.com/imp/reqwest-pretty-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imp%2Freqwest-pretty-json/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261479172,"owners_count":23164637,"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-11-20T22:48:23.572Z","updated_at":"2025-06-23T12:33:17.955Z","avatar_url":"https://github.com/imp.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reqwest-pretty-json\n\n`reqwest` provides an easy way to send a JSON formatted `HTTP body` of the request.\nHowever, it gives you zero control of how the serialization is done.\nWhatever `serde_json::to_vec()` emits [single condensed string] is going to be used.\nIn vast majority of the case it is good and does the job very well.\nHowever, sometimes you may want to have it \"prettified\".\nFor example, when talking to KV stores (that just keep the bytes you've sent them and do not interpret it in any way)\nit may be desirable to have your JSON text more human-readable.\nThere is no way to do it directly with `reqwest`.\nOf course you can always manually serialize the data structure into anything you want\n(pretty JSON) and manually set it as request body as well as adding `Content-Type: application/json` header.\nThis, however, is less nice than the just letting `reqwest::RequestBuilder` do the right thing.\n\nExactly for cases like that this crate augments `reqwest::RequestBuilder` with `pretty_json()` method.\n\n```rust\nuse reqwest::Client;\nuse reqwest_pretty_json::PrettyJson;\n\nlet data = vec![1, 2, 3];\nlet client = Client::new();\nclient\n    .post(\"http://httpbin.org/post\")\n    .pretty_json(\u0026data)\n    .send()\n    .unwrap();\n```\n\nUnder the hood it uses `serde_json::to_vec_pretty()` to serialize the data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimp%2Freqwest-pretty-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimp%2Freqwest-pretty-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimp%2Freqwest-pretty-json/lists"}