{"id":15890593,"url":"https://github.com/dimfeld/sqlx-transparent-json-decode","last_synced_at":"2026-01-11T05:52:02.489Z","repository":{"id":169953339,"uuid":"646079731","full_name":"dimfeld/sqlx-transparent-json-decode","owner":"dimfeld","description":"Easier JSON decoding with sqlx","archived":false,"fork":false,"pushed_at":"2024-04-24T08:20:31.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T13:41:22.344Z","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/dimfeld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2023-05-27T08:07:05.000Z","updated_at":"2024-07-23T21:54:39.160Z","dependencies_parsed_at":"2023-11-23T10:29:27.907Z","dependency_job_id":"9e33ce77-0f9e-4ae1-97ff-6d741bb0c411","html_url":"https://github.com/dimfeld/sqlx-transparent-json-decode","commit_stats":null,"previous_names":["dimfeld/sqlx-transparent-json-decode"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsqlx-transparent-json-decode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsqlx-transparent-json-decode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsqlx-transparent-json-decode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsqlx-transparent-json-decode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimfeld","download_url":"https://codeload.github.com/dimfeld/sqlx-transparent-json-decode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246856583,"owners_count":20844974,"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-10-06T07:06:56.704Z","updated_at":"2026-01-11T05:52:02.477Z","avatar_url":"https://github.com/dimfeld.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlx-transparent-json-decode\n\n\u003ca href=\"https://docs.rs/sqlx-transparent-json-decode\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\"\n      alt=\"docs.rs docs\" /\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://crates.io/crates/sqlx\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/d/sqlx-transparent-json-decode.svg?style=flat-square\"\n      alt=\"Download\" /\u003e\n  \u003c/a\u003e\n\nThis crate is meant for use with [sqlx](https://github.com/launchbadge/sqlx) and allows you to query JSON or JSONB fields from PostgreSQL without needing to wrap the types in a `sqlx::types::Json\u003c\u003e` wrapper type.\n\n```rust\nuse serde::{Deserialize, Serialize};\nuse sqlx_transparent_json_decode::sqlx_json_decode;\n\n#[derive(Serialize, Deserialize)]\npub struct SomeJsonField {\n    // Whatever fields match the JSON structure\n    pub name: String,\n    pub some_param: Option\u003cString\u003e,\n    pub count: i32,\n}\n\nsqlx_json_decode!(SomeJsonField);\n\n#[derive(sqlx::FromRow)]\npub struct QueryResult {\n    pub id: i32,\n    pub name: String,\n    pub params: SomeJsonField,\n}\n```\n\nNormally, you would need to use `Json\u003cSomeJsonField\u003e` as the type for `params` in the above example. This crate allows you to use `SomeJsonField` directly.\n\n```rust\nlet result = sqlx::query_as!(\n    QueryResult,\n    r##\"SELECT id,\n        name,\n        params as \"params: SomeJsonField\"\n      FROM some_table\"##,\n).fetch_one(\u0026pool).await?;\n```\n\nThis crate also provides `BoxedRawValue`, a wrapper around `Box\u003cserde_json::value::RawValue\u003e` which can be decoded directly. This is\notherwise difficult to do using sqlx's query macros.\n\n```rust\nlet result = sqlx::query!(\n    r##\"SELECT id, data as \"data: BoxedRawValue\" FROM table##\"\n).fetch_one(\u0026pool).await?;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fsqlx-transparent-json-decode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimfeld%2Fsqlx-transparent-json-decode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fsqlx-transparent-json-decode/lists"}