{"id":44170,"library":"zol-json","title":"zol-json","description":"JSON SQL query building for Zol ORM. This package provides TypeScript-first utilities to construct SQL JSON functions like json_agg, json_build_object, and row_to_json using Zol's query builder. Currently at version 0.5.1, it is released on npm intermittently as part of the Zol ecosystem. Key differentiator: tight integration with Zol's type-safe query interface, enabling typed JSON aggregation without raw SQL strings.","status":"active","version":"0.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/MedFlyt/zol","tags":["javascript","typescript","sql","query","postgresql","postgres","orm"],"install":[{"cmd":"npm install zol-json","lang":"bash","label":"npm"},{"cmd":"yarn add zol-json","lang":"bash","label":"yarn"},{"cmd":"pnpm add zol-json","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: core ORM required for query building","package":"zol","optional":false}],"imports":[{"note":"ESM-only; TypeScript type definitions included.","wrong":"const zolJson = require('zol-json')","symbol":"default","correct":"import zolJson from 'zol-json'"},{"note":"Named export works in both ESM and CJS if module resolution allows, but prefer ESM.","wrong":"const { jsonAgg } = require('zol-json')","symbol":"jsonAgg","correct":"import { jsonAgg } from 'zol-json'"},{"note":"CommonJS require of named exports works but is less ergonomic.","wrong":"const jsonBuildObject = require('zol-json').jsonBuildObject","symbol":"jsonBuildObject","correct":"import { jsonBuildObject } from 'zol-json'"}],"quickstart":{"code":"import zol from 'zol';\nimport { jsonAgg, jsonBuildObject } from 'zol-json';\n\nconst db = zol(process.env.DATABASE_URL ?? '');\n\nconst users = db.selectFrom('users')\n  .select([\n    'id',\n    'name',\n    jsonBuildObject({ email: 'email', age: 'age' }).as('profile'),\n    jsonAgg('id').as('all_ids')\n  ])\n  .where('age', '>', 18)\n  .execute();\n\nconsole.log(await users);","lang":"typescript","description":"Build a SQL query with JSON functions using Zol query builder."},"warnings":[{"fix":"Pin exact version and read changelog before upgrading.","message":"Export names are subject to change before 1.0; check TypeDoc for exact names.","severity":"gotcha","affected_versions":"<1.0"},{"fix":"Replace 'jsonObject' with 'jsonBuildObject' in imports and usage.","message":"The function 'jsonObject' was renamed to 'jsonBuildObject' in 0.4.0.","severity":"deprecated","affected_versions":"<0.4.0"},{"fix":"Ensure 'zol' is installed and version matches 'zol-json' exactly.","message":"Requires peer dependency 'zol' at same version; missing or mismatched zol version causes runtime errors.","severity":"gotcha","affected_versions":"*"},{"fix":"Use only with PostgreSQL database.","message":"Functions only work with PostgreSQL; no other SQL dialects supported.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'0.5.1':41 'agg':25 'aggreg':69 'build':7,27 'builder':37 'construct':19 'current':38 'differenti':55 'ecosystem':53 'enabl':66 'first':16 'function':22 'integr':57 'interfac':65 'intermitt':47 'javascript':74 'json':3,4,21,24,26,32,68 'key':54 'like':23 'npm':46 'object':28 'orm':10,80 'packag':12 'part':49 'postgr':79 'postgresql':78 'provid':13 'queri':6,36,64,77 'raw':71 'releas':44 'row':30 'safe':63 'sql':5,20,72,76 'string':73 'tight':56 'type':62,67 'type-saf':61 'typescript':15,75 'typescript-first':14 'use':33 'util':17 'version':40 'without':70 'zol':2,9,34,52,59 'zol-json':1","created_at":"2026-06-05T17:03:19.095125+00:00","updated_at":"2026-06-05T17:03:19.095125+00:00","problems":[{"fix":"Run 'npm install zol-json' and ensure project name is correct.","cause":"Package not installed or not in node_modules","error":"Cannot find module 'zol-json'"},{"fix":"Use 'import zol from 'zol'' instead of 'const zol = require('zol')'.","cause":"CommonJS require used instead of ESM import for zol","error":"TypeError: zol_1.default is not a function"},{"fix":"Upgrade to version >=0.4.0: 'npm install zol-json@^0.4.0'.","cause":"Wrong version; jsonBuildObject introduced in 0.4.0","error":"jsonBuildObject is not importable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/MedFlyt/zol#readme","github":"https://github.com/MedFlyt/zol","docs":null,"changelog":null,"pypi":null,"npm":"zol-json","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}