{"id":14974117,"url":"https://github.com/t9t/jooq-postgresql-json","last_synced_at":"2025-10-27T06:31:50.454Z","repository":{"id":43087373,"uuid":"196727538","full_name":"t9t/jooq-postgresql-json","owner":"t9t","description":"jOOQ support for PostgreSQL json \u0026 jsonb","archived":false,"fork":false,"pushed_at":"2024-02-21T00:10:23.000Z","size":250,"stargazers_count":55,"open_issues_count":6,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-28T18:23:48.080Z","etag":null,"topics":["java","jooq","jooq-generator","json","jsonb","postgres","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/t9t.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-13T13:56:18.000Z","updated_at":"2024-07-18T12:29:43.000Z","dependencies_parsed_at":"2022-08-28T15:34:00.341Z","dependency_job_id":null,"html_url":"https://github.com/t9t/jooq-postgresql-json","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t9t%2Fjooq-postgresql-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t9t%2Fjooq-postgresql-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t9t%2Fjooq-postgresql-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t9t%2Fjooq-postgresql-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t9t","download_url":"https://codeload.github.com/t9t/jooq-postgresql-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861742,"owners_count":16555987,"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":["java","jooq","jooq-generator","json","jsonb","postgres","postgresql"],"created_at":"2024-09-24T13:49:58.970Z","updated_at":"2025-10-27T06:31:48.919Z","avatar_url":"https://github.com/t9t.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚠ Unmaintained ⚠\nUnfortunately, I no longer use jOOQ or `jooq-postgresql-json` myself, and so I don't feel comfortable maintaining this\nlibrary anymore. I will no longer test the library when new jOOQ versions come out, and I won't closely follow jOOQ\nnews anymore to keep an eye out for new features to integrate with.\n\nSee also: https://github.com/t9t/jooq-postgresql-json/issues/24.\n\n# jOOQ PostgreSQL JSON support\nProvides jOOQ support for [PostgreSQL JSON functions and operators](https://www.postgresql.org/docs/11/functions-json.html)\nfor `json` and `jsonb` fields.\n\n**Requires at least Java 11.**\n\n⚠ Since version 4.0.0 this library does not include a transitive Maven dependency on `jooq` any more, you have to\ninclude both `jooq` and `jooq-postgresql-json` in your project to use it.\n\n- [Include as a Maven dependency](#include-as-a-maven-dependency)\n- [Usage](#usage)\n  - [Kotlin extension functions](#kotlin)\n- [PostgreSQL json operator support](#postgresql-json-operator-support)\n- [Available PostgreSQL json processing functions](#available-postgresql-json-processing-functions)\n- [References](#references)\n- [Contributors](#contributors)\n- [![Javadocs](https://javadoc.io/badge/com.github.t9t.jooq/jooq-postgresql-json.svg)](https://javadoc.io/doc/com.github.t9t.jooq/jooq-postgresql-json)\n\n---\n\n\n## Include as a Maven dependency\nFirst, add the following Maven dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.t9t.jooq\u003c/groupId\u003e\n  \u003cartifactId\u003ejooq-postgresql-json\u003c/artifactId\u003e\n  \u003cversion\u003e4.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n`jooq-postgresql-json` does not include a transitive dependency on `jooq`, so you have to include that yourself as well.\n\n### Version matrix\n\nAs for 4.0.0, this shows only which jOOQ versions are explicitly tested with this library. Minor version differences\nshould still be compatible and newer major versions of jOOQ might still work with older versions of this library if\nnothing changed much in the jOOQ JSON APIs. New releases will only be created when incompatibilities with new jOOQ\nversions are found and fixed.\n\nSee [the changelog](changelog.md) for more information about what is included in the various releases and the reason for\nthe breaking changes.\n\n| Library version | jOOQ version | Note |\n| --- | --- | --- |\n| 4.0.0 | 3.16.x - 3.18.x | Breaking change, no longer includes a dependency on `jooq`. Tested with both jOOQ `3.16.20` (JDK 11 and 17), and `3.17.14` and `3.18.5` (JDK 17 only). |\n| 3.2.3 | 3.16.7 |\n| 3.2.2 | 3.16.6 |\n| 3.2.1 | 3.16.5 |\n| 3.2.0 | 3.16.3 |\n| 3.1.2 | 3.15.5 |\n| 3.1.1 | 3.15.4 |\n| 3.1.0 | 3.15.1 |\n| 3.0.0 | 3.14.12 | Breaking change, upgraded from Java 8 to Java 11. Java 8 no longer supported. |\n\n\n## Usage\n\nUse\nthe [`JsonDSL`](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/JsonDSL.html)\nand [`JsonbDSL`](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/JsonbDSL.html)\nclasses to access the JSON functions and operators.\n\nFor example, to extract a JSON nested property value as text from a `json` field:\n\n```java\n/* Sample JSON:\n{\n  \"data\": {\n    \"productCode\": \"Z-5521\"\n  }\n}\n*/\nString productCode = dsl.select(JsonDSL.extractPathText(MY_TABLE.DATA_FIELD, \"data\", \"productCode\"))\n    .from(MY_TABLE).fetchOneInto(String.class);\n``` \n\nOr for example using the `@\u003e` operator to update a row of which a `jsonb` field contains a certain id:\n\n```java\n/* Sample JSON:\n{\n  \"id\": \"1337\",\n  \"name\": \"The Hitchhiker's Guide to the Galaxy\"\n}\n*/\ndsl.update(MY_TABLE)\n    .set(MY_TABLE.RATING, 100)\n    .where(JsonbDSL.contains(MY_TABLE.DATA_FIELD, JsonbDSL.field(\"{\\\"id\\\": \\\"1337\\\"}\")))\n    .execute()\n``` \n\n- [`JsonDSL` Javadoc](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/JsonDSL.html)\n- [`JsonbDSL` Javadoc](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/JsonbDSL.html)\n\n### Kotlin\n\nKotlin extension functions are available for `Field\u003cJSON?\u003e` and `Field\u003cJSONB?\u003e`. That means that instead of something\nlike `JsonDSL.extractPathText(MY_TABLE.DATA_FIELD, \"data\", \"productCode\")` you can instead write:\n`MY_TABLE.DATA_FIELD.extractPathText(\"data\", \"productCode\")`.\n\nThe extension functions are available in the following packages:\n\n- [`com.github.t9t.jooq.json.json`](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/json)\n- [`com.github.t9t.jooq.json.jsonb`](https://javadoc.io/static/com.github.t9t.jooq/jooq-postgresql-json/4.0.0/com/github/t9t/jooq/json/jsonb)\n\nThe names of extension functions match the names of the methods on `JsonDSL` and `JsonbDSL`, except for `concat` and\n`contains`, which are called `concatJson` and `containsJson` respectively to prevent clashes with existing methods\nof `Field`.\n\n## PostgreSQL json operator support\nReference: https://www.postgresql.org/docs/11/functions-json.html\n\nOperators available for both `json` (through `JsonDSL`) and `jsonb` (through `JsonbDSL`):\n\n| Op | Operand | Description | Method |\n| --- | --- | --- | --- |\n| `-\u003e` | `int` | Get array element | `arrayElement()` |\n| `-\u003e` | `text` | Get object field | `fieldByKey()` |\n| `-\u003e\u003e` | `int` | Get array element as text | `arrayElementText()` |\n| `-\u003e\u003e` | `text` | Get object field as text | `fieldByKeyText()` |\n| `#\u003e` | `text[]` | Get object at path | `objectAtPath()` |\n| `#\u003e\u003e` | `text[]` | Get object at path as text | `objectAtPathText()` |\n\nOperators available only for `jsonb` (through `JsonbDSL`):\n\n\n| Op | Operand | Description | Method |\n| --- | --- | --- | --- |\n| `@\u003e` | `jsonb` | Does contain value? | `contains()` |\n| `\u003c@` | `jsonb` | Are entries contained? | `containedIn()` |\n| `?` | `text` | Does the key exist? | `hasKey()` |\n| \u003ccode\u003e?\u0026#124;\u003c/code\u003e | `text[]` | Does any key exist? | `hasAnyKey()` |\n| `?\u0026` | `text[]` | Do all keys exist? | `hasAllKeys()` |\n| \u003ccode\u003e\u0026#124;\u0026#124;\u003c/code\u003e | `jsonb` | Concatenate values | `concat()` |\n| `-` | `text` | Delete key or element | `delete()` |\n| `-` | `text[]` | Delete multiple keys or elements | `delete()` |\n| `-` | `int` | Delete array element | `deleteElement()` |\n| `#-` | `text[]` | Delete field for path | `deletePath()` |\n\n\n## Available PostgreSQL json processing functions\nReference: https://www.postgresql.org/docs/11/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE\n\nProcessing functions available for both `json` (through `JsonDSL`) and `jsonb` (through `JsonbDSL`):\n\n| Function | Return type | Description | Method |\n| --- | --- | --- | --- |\n| `json(b)_array_length` | `int` | Get length of JSON array | `arrayLength()` |\n| `json(b)_extract_path` | `json`/`jsonb` | Extract object at path (same as `#\u003e`) | `extractPath()` |\n| `json(b)_extract_path_text` | `text` | Extract object at path as text (same as `#\u003e\u003e`) | `extractPathText()` |\n| `json(b)_typeof` | `text` | Get the type of a JSON field | `typeOf()` |\n| `json(b)_strip_nulls` | `json`/`jsonb` | Remove object fields with `null` values | `stripNulls()` |\n\nFunctions only available for `jsonb` (through `JsonbDSL`):\n\n| Function | Return type | Description | Method |\n| --- | --- | --- | --- |\n| `jsonb_pretty` | `text` | Pretty format JSON field | `pretty()` |\n\n\n## References\n- [jOOQ.org](https://www.jooq.org/)\n- [PostgreSQL JSON data types](https://www.postgresql.org/docs/current/datatype-json.html)\n\n\n## Contributors\n- [@davinkevin](https://github.com/davinkevin) was kind enough to implement Kotlin extension functions ([#11](https://github.com/t9t/jooq-postgresql-json/issues/11) and [#12](https://github.com/t9t/jooq-postgresql-json/pull/12))!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft9t%2Fjooq-postgresql-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft9t%2Fjooq-postgresql-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft9t%2Fjooq-postgresql-json/lists"}