We're opening this issue to gather community feedback on the language design decisions we've made for query-json v1. While we've put a lot of thought into these choices, we want to hear other views from our users.
Context
query-json started as a jq-compatible implementation but evolved into it's own different language. We made intentional breaking changes where we believed jq's design was confusing or could be improved. These decisions are documented in our jq Compatibility Guide.
Key design decisions
1. Naming conventions
snake_case everywhere (to_string instead of tostring)
- More descriptive names (
to_uppercase instead of ascii_upcase, trim_start instead of ltrimstr)
fn instead of def for user-defined functions
trim_left instead of ltrimstr and trim_right instead of rtrimstr, so autocompletion in the repl and user discovery is better
byte_length instead of utf8bytelength
Question: Are there any renamed functions that feel awkward or harder to discover?
2. Behavioral changes
group_by returns an object instead of nested arrays
keys and unique preserve insertion order (instead of sorting)
infinite is a generator instead of IEEE infinity
Question: Do any of these changes cause friction in your workflows?
3. Optional access on functions
We extended ? to work on any expression, not just field access: first?, keys?, nth(10)?.
Question: Is this intuitive? Any edge cases we should consider?
What should we do with unsupported functions?
Some jq functions are not implemented. Currently, using them produces errors like:
| Function |
Current behavior |
strftime, strptime |
error: time formatting not implemented |
modulemeta |
error: modulemeta not implemented |
tojsonstream, fromjsonstream, truncate_stream |
error: JSON stream functions not implemented |
tojson, fromjson |
error: not implemented, use to_string (input is already JSON) |
input_filename, input_line_number |
error: input metadata not implemented |
Modules (import, include) |
Not implemented |
Format strings (@base64, @uri, @csv, etc.) |
Not implemented |
Questions:
- Should we prioritize implementing any of these?
- For functions we don't plan to implement, should we provide better error messages with workarounds?
- Are there jq functions you rely on that aren't listed here?
- Any other thing you hate/love about jq?
- Are the added functions worth it? https://github.com/davesnx/query-json/blob/main/docs/JQ_COMPATIBILITY.md#additional-features-in-query-json
- Should we implement modules differently from jq and have "namespaces" for groups of functions? I'm thinking Math.sin, Math.pi, etc instead of being at the root namespace?
We're opening this issue to gather community feedback on the language design decisions we've made for query-json v1. While we've put a lot of thought into these choices, we want to hear other views from our users.
Context
query-json started as a jq-compatible implementation but evolved into it's own different language. We made intentional breaking changes where we believed jq's design was confusing or could be improved. These decisions are documented in our jq Compatibility Guide.
Key design decisions
1. Naming conventions
snake_caseeverywhere (to_stringinstead oftostring)to_uppercaseinstead ofascii_upcase,trim_startinstead ofltrimstr)fninstead ofdeffor user-defined functionstrim_leftinstead ofltrimstrandtrim_rightinstead ofrtrimstr, so autocompletion in the repl and user discovery is betterbyte_lengthinstead ofutf8bytelengthQuestion: Are there any renamed functions that feel awkward or harder to discover?
2. Behavioral changes
group_byreturns an object instead of nested arrayskeysanduniquepreserve insertion order (instead of sorting)infiniteis a generator instead of IEEE infinityQuestion: Do any of these changes cause friction in your workflows?
3. Optional access on functions
We extended
?to work on any expression, not just field access:first?,keys?,nth(10)?.Question: Is this intuitive? Any edge cases we should consider?
What should we do with unsupported functions?
Some jq functions are not implemented. Currently, using them produces errors like:
strftime,strptimeerror: time formatting not implementedmodulemetaerror: modulemeta not implementedtojsonstream,fromjsonstream,truncate_streamerror: JSON stream functions not implementedtojson,fromjsonerror: not implemented, use to_string (input is already JSON)input_filename,input_line_numbererror: input metadata not implementedimport,include)@base64,@uri,@csv, etc.)Questions: