Skip to content

fix(jq): use pretty-printed output for arrays and objects#39

Merged
chaliy merged 1 commit intomainfrom
claude/fix-jq-filter-tests-Z1pmc
Feb 2, 2026
Merged

fix(jq): use pretty-printed output for arrays and objects#39
chaliy merged 1 commit intomainfrom
claude/fix-jq-filter-tests-Z1pmc

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 2, 2026

Summary

  • Fix jq builtin to use pretty-printed JSON output for arrays/objects to match real jq behavior
  • Real jq uses 2-space indentation; BashKit was outputting compact JSON

Changes

  • Use serde_json::to_string_pretty() for arrays and objects
  • Keep compact output for scalar values (strings, numbers, booleans, null)
  • Added tests: jq_filter, jq_map_alternate, jq_nested_object
  • Updated 8 existing tests to expect pretty-printed output

Test plan

  • All 23 jq spec tests pass (1 skipped for -r flag)
  • All 6 jq unit tests pass
  • cargo fmt --check passes
  • cargo clippy passes

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Real jq defaults to pretty-printed JSON output with 2-space indentation
for arrays and objects. BashKit's jq builtin was using compact output
via serde_json::to_string().

Changed to use serde_json::to_string_pretty() for arrays and objects
while keeping compact output for scalar values (strings, numbers,
booleans, null).

Added tests for jq_filter and jq_map_alternate cases that demonstrate
the pretty-print behavior.
@chaliy chaliy force-pushed the claude/fix-jq-filter-tests-Z1pmc branch from 62422ba to 4b28921 Compare February 2, 2026 03:18
@chaliy chaliy merged commit 0363b01 into main Feb 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants