SOQL Parser JS
Parse and generate SOQL queries
Parse
SELECT NameFROM AccountWHERE Industry = 'media'ORDER BY BillingPostalCode ASC NULLS LASTLIMIT 125
into
{"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
{"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}
into
SELECT NameFROM AccountWHERE Industry = 'media'ORDER BY BillingPostalCode ASC NULLS LASTLIMIT 125
Battle Tested
Your SOQL query is parsed using a language parser, Chevrotain JS, and aims to support every SOQL feature.
This library has been powering Jetstream in production for many years and has parsed and composed millions of queries from thousands of users.