{"id":43913,"library":"sql-jsonpath-js","title":"SQL/JSONPath for JS","description":"JavaScript implementation of the SQL/JSONPath dialect from SQL2016, version 1.0.1. Provides exists() and values() methods for querying JSON data, similar to JavaScript's RegExp. Includes TypeScript definitions. Suitable for streaming data with lazy iterator support. Differentiated from other JSONPath libraries by strict adherence to the SQL standard and iterator-based API.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/mattbishop/sql-jsonpath-js","tags":["javascript","typescript"],"install":[{"cmd":"npm install sql-jsonpath-js","lang":"bash","label":"npm"},{"cmd":"yarn add sql-jsonpath-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add sql-jsonpath-js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library uses named exports; default import is not available.","wrong":"import sqlJsonPath from 'sql-jsonpath-js'","symbol":"compile","correct":"import { compile } from 'sql-jsonpath-js'"},{"note":"Library is ESM-only in v1.0.1; CommonJS require is not supported.","wrong":"const { SqlJsonPathStatement } = require('sql-jsonpath-js')","symbol":"SqlJsonPathStatement","correct":"import { SqlJsonPathStatement } from 'sql-jsonpath-js'"},{"note":"Utility to extract first value from iterator, returns null if empty.","wrong":null,"symbol":"one","correct":"import { one } from 'sql-jsonpath-js'"}],"quickstart":{"code":"import { compile, one } from 'sql-jsonpath-js';\n\nconst statement = compile('$.name');\nconst data = { name: 'Alice' };\n\nconsole.log(statement.exists(data)); // true\n\nconst value = one(statement.values(data));\nconsole.log(value); // 'Alice'","lang":"typescript","description":"Demonstrates compiling a JSONPath, checking existence, and extracting a value with the one() helper."},"warnings":[{"fix":"Call data[Symbol.iterator]() when passing arrays as iterables.","message":"Array input to values() or exists() is treated as a single object, not an iterable. Use [Symbol.iterator]() to iterate over array elements.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use one() for single expected result or iterate properly.","message":"values() returns an iterator; results must be consumed via next() or Array.from(). one() returns null on empty results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check input type: if using with iterators, expect iterator result.","message":"exists() on an iterator returns an iterator of booleans; on a single value it returns a boolean. This dual behavior can be confusing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':13 'adher':46 'api':55 'base':54 'data':22,34 'definit':30 'dialect':9 'differenti':39 'exist':15 'implement':5 'includ':28 'iter':37,53 'iterator-bas':52 'javascript':4,25,56 'js':3 'json':21 'jsonpath':42 'lazi':36 'librari':43 'method':18 'provid':14 'queri':20 'regexp':27 'similar':23 'sql':49 'sql/jsonpath':1,8 'sql2016':11 'standard':50 'stream':33 'strict':45 'suitabl':31 'support':38 'typescript':29,57 'valu':17 'version':12","created_at":"2026-06-05T17:02:05.047193+00:00","updated_at":"2026-06-05T17:02:05.047193+00:00","problems":[{"fix":"Use import { compile } from 'sql-jsonpath-js'","cause":"Importing default export instead of named export.","error":"TypeError: sjp.compile is not a function"},{"fix":"Ensure compile() returns a SqlJsonPathStatement object.","cause":"Statement not compiled properly or imported incorrectly.","error":"TypeError: statement.values is not a function"}],"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/mattbishop/sql-jsonpath-js#readme","github":"https://github.com/mattbishop/sql-jsonpath-js","docs":null,"changelog":null,"pypi":null,"npm":"sql-jsonpath-js","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}}