[PR #5703] [MERGED] feat(common): use jq for JSON response filtering #5322

Closed
opened 2026-03-17 02:46:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5703
Author: @gerardbalaoro
Created: 12/17/2025
Status: Merged
Merged: 1/15/2026
Merged by: @jamesgeorge007

Base: nextHead: use-jq-for-json-filter


📝 Commits (2)

  • 1d66914 feat(common): use jq for JSON response filtering
  • d89336c fix: improve jq filter UX with debouncing and better errors

📊 Changes

34 files changed (+94 additions, -104 deletions)

View changed files

📝 packages/hoppscotch-common/locales/af.json (+1 -1)
📝 packages/hoppscotch-common/locales/ar.json (+1 -1)
📝 packages/hoppscotch-common/locales/ca.json (+1 -1)
📝 packages/hoppscotch-common/locales/cn.json (+1 -1)
📝 packages/hoppscotch-common/locales/cs.json (+1 -1)
📝 packages/hoppscotch-common/locales/da.json (+1 -1)
📝 packages/hoppscotch-common/locales/de.json (+1 -1)
📝 packages/hoppscotch-common/locales/el.json (+1 -1)
📝 packages/hoppscotch-common/locales/en.json (+1 -1)
📝 packages/hoppscotch-common/locales/es.json (+1 -1)
📝 packages/hoppscotch-common/locales/fi.json (+1 -1)
📝 packages/hoppscotch-common/locales/fr.json (+1 -1)
📝 packages/hoppscotch-common/locales/he.json (+1 -1)
📝 packages/hoppscotch-common/locales/hu.json (+1 -1)
📝 packages/hoppscotch-common/locales/id.json (+1 -1)
📝 packages/hoppscotch-common/locales/it.json (+1 -1)
📝 packages/hoppscotch-common/locales/ja.json (+1 -1)
📝 packages/hoppscotch-common/locales/ko.json (+1 -1)
📝 packages/hoppscotch-common/locales/nl.json (+1 -1)
📝 packages/hoppscotch-common/locales/no.json (+1 -1)

...and 14 more files

📄 Description

Closes #4067

Note

This replaces JSONPath with jq for JSON response filtering. Users with existing JSONPath filters will need to migrate to jq syntax; refer to the migration guide below.


What's Changed

  • Replaced jsonpath-plus with jq-wasm (v1.1.0-jq-1.8.1) for JSON filtering.
  • Converted filtering from computed to computedAsync (jq-wasm is async-only).
  • Added 300ms input debounce to prevent excessive processing.
    -- Surface actual jq error messages (first line of stderr).
  • Updated 30+ locale files to reference jq syntax.
  • Updated help link to point to jq manual.

Trade-offs

Aspect Impact
Bundle size +~750KB (jq-wasm WASM binary)
Capability Significantly more powerful filtering (sorting, grouping, math, etc.)
Performance Slightly slower on first load (WASM init), but faster for complex queries

Migration Guide: JSONPath → jq

Operation Before (JSONPath) After (jq)
Identity / Full response $ .
Property access $.name .name
Nested property $.user.email .user.email
Array index $[0] .[0]
All array items $[*] .[]
Filter by equality $[?(@.id == 5)] .[] | select(.id == 5)
Filter by comparison $[?(@.age > 18)] .[] | select(.age > 18)
Multiple conditions $[?(@.age > 18 && @.active)] .[] | select(.age > 18 and .active)
NEW: Sort by property Not supported sort_by(.name)
NEW: Unique values Not supported [.[].category] | unique

Full jq Manual - https://jqlang.org/manual
jq Playground - https://jqplay.org


Notes to Reviewers

N/A


Summary by cubic

Switched JSON response filtering from JSONPath to jq in the JSON lens. This adds jq query support, updates the UI/help, debounces input, shows a loading state, and makes filtering async with clearer errors.

  • New Features

    • Use jq for JSON response filtering (via jq-wasm).
    • Updated help link and i18n copy to “jq syntax”; async filtering with 300ms debounce, loading indicator, and improved error messages.
  • Migration

    • Rewrite any saved JSONPath filters to jq.

Written for commit d89336ce55. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5703 **Author:** [@gerardbalaoro](https://github.com/gerardbalaoro) **Created:** 12/17/2025 **Status:** ✅ Merged **Merged:** 1/15/2026 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `use-jq-for-json-filter` --- ### 📝 Commits (2) - [`1d66914`](https://github.com/hoppscotch/hoppscotch/commit/1d6691462eae269a7ce4d00cd7c8df24e7635402) feat(common): use jq for JSON response filtering - [`d89336c`](https://github.com/hoppscotch/hoppscotch/commit/d89336ce5504eecacecda3747ea502ff8012691b) fix: improve jq filter UX with debouncing and better errors ### 📊 Changes **34 files changed** (+94 additions, -104 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/locales/af.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/ar.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/ca.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/cn.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/cs.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/da.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/de.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/el.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/en.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/es.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/fi.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/fr.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/he.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/hu.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/id.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/it.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/ja.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/ko.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/nl.json` (+1 -1) 📝 `packages/hoppscotch-common/locales/no.json` (+1 -1) _...and 14 more files_ </details> ### 📄 Description Closes #4067 > [!Note] > This replaces JSONPath with jq for JSON response filtering. Users with existing JSONPath filters will need to migrate to jq syntax; refer to the migration guide below. --- ### What's Changed - Replaced `jsonpath-plus` with `jq-wasm` (`v1.1.0-jq-1.8.1`) for JSON filtering. - Converted filtering from `computed` to `computedAsync` (`jq-wasm` is async-only). - Added 300ms input debounce to prevent excessive processing. -- Surface actual `jq` error messages (first line of stderr). - Updated 30+ locale files to reference `jq syntax`. - Updated help link to point to `jq` manual. ### Trade-offs | Aspect | Impact | |--------|--------| | Bundle size | +~750KB (jq-wasm WASM binary) | | Capability | Significantly more powerful filtering (sorting, grouping, math, etc.) | | Performance | Slightly slower on first load (WASM init), but faster for complex queries | --- ### Migration Guide: JSONPath → jq | Operation | Before (JSONPath) | After (jq) | |-----------|-------------------|------------| | Identity / Full response | `$` | `.` | | Property access | `$.name` | `.name` | | Nested property | `$.user.email` | `.user.email` | | Array index | `$[0]` | `.[0]` | | All array items | `$[*]` | `.[]` | | Filter by equality | `$[?(@.id == 5)]` | `.[] \| select(.id == 5)` | | Filter by comparison | `$[?(@.age > 18)]` | `.[] \| select(.age > 18)` | | Multiple conditions | `$[?(@.age > 18 && @.active)]` | `.[] \| select(.age > 18 and .active)` | | **NEW:** Sort by property | Not supported | `sort_by(.name)` | | **NEW:** Unique values | Not supported | `[.[].category] \| unique` | Full jq Manual - https://jqlang.org/manual jq Playground - https://jqplay.org --- ### Notes to Reviewers N/A <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switched JSON response filtering from JSONPath to jq in the JSON lens. This adds jq query support, updates the UI/help, debounces input, shows a loading state, and makes filtering async with clearer errors. - **New Features** - Use jq for JSON response filtering (via jq-wasm). - Updated help link and i18n copy to “jq syntax”; async filtering with 300ms debounce, loading indicator, and improved error messages. - **Migration** - Rewrite any saved JSONPath filters to jq. <sup>Written for commit d89336ce5504eecacecda3747ea502ff8012691b. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:46:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5322
No description provided.