Skip to content

Releases: devlooped/JQSharp

v1.0.1

27 Mar 20:19
@kzu kzu

Choose a tag to compare

What's Changed

✨ Implemented enhancements

  • Add support for module metadata by @kzu in #18

πŸ“ Documentation updates

  • Add benchmarks against jq executable by @kzu in #14

Full Changelog: v1.0.0...v1.0.1

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @unoplatform, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @Eule02, @torutek, @mccaffers, @SeikaLogiciel, @wizardness, @latonz.

Thanks πŸ’œ

v1.0.0

09 Mar 18:26

Choose a tag to compare

πŸŽ‰ Release Notes β€” jq# (JQSharp)

A full .NET implementation of the jq filter language for querying and transforming JSON.


βœ… Full Feature Parity with jq

πŸ”€ Basic Selectors & Composition

  • Identity (.), field access (.foo, .foo.bar), string/index subscripts (.[string], .[number])
  • Slices (.[n:n]), iterators (.[], .[]?)
  • Pipe (|), comma (,), parentheses
  • Array ([expr]) and object ({key: value}) constructors
  • Recursive descent (..)

πŸ’¬ Comments

  • # line comments with \ continuation to the next line

πŸ”’ Operators

  • Arithmetic: +, -, *, /, % with type-aware behavior for strings, arrays, and objects
  • Unary negation: -expr
  • Comparison: ==, !=, <, >, <=, >=
  • Logical: and, or, not
  • Alternative: // β€” falls back to right-hand side when left is false or null

πŸ”€ Conditionals

  • if-then-elif-else-end

❓ Optional Operator

  • ? β€” suppresses errors on any expression

πŸ“¦ Literals

  • null, true, false, numbers, strings (with escape sequences)

πŸ—οΈ Builtin Functions

Zero-Argument Builtins

  • Generator: empty
  • Type introspection: type, length, utf8bytelength, infinite, nan, isinfinite, isnan, isfinite, isnormal
  • Type selectors: arrays, objects, iterables, booleans, numbers, normals, finites, strings, nulls, values, scalars
  • Object/array: keys, keys_unsorted, reverse, sort, unique, flatten, add, any, all, min, max, to_entries, from_entries, paths, transpose, combinations
  • Conversion: tonumber, tostring, toboolean, tojson, fromjson, explode, implode, ascii_downcase, ascii_upcase
  • Math: abs, floor, sqrt
  • String: trim, ltrim, rtrim
  • Other: recurse, halt, env, builtins, first, last

πŸ” Type/Value Testing & Selection

  • has(key), in, select(expr), contains(element), inside
  • isempty(exp), any(cond), all(cond), any(gen; cond), all(gen; cond)

βœ‚οΈ String Operations

  • startswith(str), endswith(str)
  • ltrimstr(str), rtrimstr(str), trimstr(str)
  • split(str), join(str)

πŸ—ƒοΈ Array/Collection Transformation

  • map(f), map_values(f), with_entries(f)
  • flatten(depth), combinations(n), add(generator)

πŸ“Š Sorting, Grouping & Extrema

  • sort_by(path), group_by(path), unique_by(path)
  • min_by(path), max_by(path)

πŸ”Ž Search & Indexing

  • index(s), rindex(s), indices(s), bsearch(x)

πŸ—ΊοΈ Path Expressions & Structural Manipulation

  • path(expr), paths(filter), pick(pathexps), del(expr)
  • getpath(PATHS), delpaths(PATHS), setpath(PATHS; VALUE)

πŸ” Generators & Iteration

  • range(upto), range(from; upto), range(from; upto; by)
  • limit(n; expr), skip(n; expr), first(expr), last(expr)
  • nth(n), nth(n; expr)
  • while(cond; update), until(cond; next), repeat(exp)
  • recurse(f), recurse(f; cond), walk(f)

⚠️ Error Control

  • error(message), halt_error(exit_code), $__loc__

🧡 String Interpolation

  • \(expr) inside string literals β€” full support for nested expressions

πŸ›‘οΈ try-catch & Error Handling

  • try EXP catch EXP, try EXP (shorthand), error (0-arg)
  • ? operator as syntactic sugar for try EXP

πŸ“ Variables & Binding

  • EXP as $identifier | ...
  • Destructuring: . as [$a, $b], . as {$a, $b}, . as {key: $var}
  • $ENV variable

πŸ”„ reduce & foreach

  • reduce EXP as $var (INIT; UPDATE)
  • foreach EXP as $var (INIT; UPDATE; EXTRACT)

🧩 User-Defined Functions

  • def name: body;
  • def name(f) β€” filter arguments
  • def name($var) β€” value arguments (syntactic sugar)
  • Full function scoping, recursion, and multiple definitions by arity

πŸ–ŠοΈ Assignment Operators

  • Update-assignment: |=
  • Plain assignment: =
  • Arithmetic update-assignment: +=, -=, *=, /=, %=, //=
  • Complex assignments (LHS with iterators, select, etc.)

🎨 Format Strings & Escaping

  • @base64, @base64d, @html, @uri, @urid, @csv, @tsv, @sh, @json, @text
  • Combined format with interpolation: @foo "string with \(expr)"

πŸ”‘ Regular Expressions

  • test(val), test(regex; flags)
  • match(val), match(regex; flags), capture(val), capture(regex; flags)
  • scan(regex), scan(regex; flags)
  • split(regex; flags), splits(regex), splits(regex; flags)
  • sub(regex; tostr), sub(regex; tostr; flags)
  • gsub(regex; tostr), gsub(regex; tostr; flags)

βž— Math Functions

  • One-input: acos, acosh, asin, asinh, atan, atanh, cbrt, ceil, cos, cosh, erf, erfc, exp, exp2, expm1, fabs, floor, log, log10, log2, round, sin, sinh, tan, tanh, trunc, and more
  • Two-input: atan2, pow, fmax, fmin, fmod, hypot, remainder, and more
  • Three-input: fma

πŸ“… Date Functions

  • now, todate, fromdate, todateiso8601, fromdateiso8601
  • strptime(fmt), strftime(fmt), strflocaltime(fmt)
  • gmtime, localtime, mktime

🚦 Advanced Control Flow

  • label $name | ... break $name ...
  • Destructuring alternative operator ?//
  • SQL-style operators: INDEX, IN, JOIN

πŸ“‘ JSONL / NDJSON Streaming

  • Async streaming support for JSONL and NDJSON input

πŸ“¦ Modules

  • include RelativePathString [<metadata>]; β€” include modules with path resolution and caching
  • import RelativePathString as NAME [<metadata>]; β€” import modules as a namespace
  • import RelativePathString as $NAME [<metadata>]; β€” import data modules as a variable

Full Changelog: https://github.com/devlooped/JQSharp/commits/v1.0.0-beta

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @unoplatform, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @davidjenni, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @Eule02, @torutek, @mccaffers, @SeikaLogiciel, @wizardness.

Thanks πŸ’œ