Skip to main content

Open Source SOQL Toolkit

SOQL Parser JS

Parse, compose, and format SOQL queries with zero runtime dependencies.

npm install @jetstreamapp/soql-parser-js
{ }

Parse

SOQL string to structured AST

SELECT Name
FROM Account
WHERE Industry = 'media'
ORDER BY BillingPostalCode ASC NULLS LAST
LIMIT 125
{
"fields": [
{
"type": "Field",
"field": "Name"
}
],
"sObject": "Account",
"where": {
"left": {
"field": "Industry",
"operator": "=",
"literalType": "STRING",
"value": "'media'"
}
},
"orderBy": [
{
"field": "BillingPostalCode",
"order": "ASC",
"nulls": "LAST"
}
],
"limit": 125
}
< >

Compose

AST back to SOQL string

{
"fields": [
{
"type": "Field",
"field": "Name"
}
],
"sObject": "Account",
"where": {
"left": {
"field": "Industry",
"operator": "=",
"literalType": "STRING",
"value": "'media'"
}
},
"orderBy": [
{
"field": "BillingPostalCode",
"order": "ASC",
"nulls": "LAST"
}
],
"limit": 125
}
SELECT Name
FROM Account
WHERE Industry = 'media'
ORDER BY BillingPostalCode ASC NULLS LAST
LIMIT 125
////

Battle Tested

Production-proven reliability

0Runtime Dependencies
330+Test Cases

Built on a hand-rolled recursive descent parser for maximum performance and a tiny bundle size. Aims to support every SOQL feature.

Powering Jetstream in production for many years — billions of queries parsed and composed from thousands of users.