Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JSONPath: big numbers in the results are rounded

Aperta
#238 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@arxh80 ci sta già lavorando.

Dal 21/10/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, typescript

Direzione di ricerca

Read lib/jsonpath.ts and its tests in lib/__tests__/jsonpath.test.ts, then trace how ConversionPanel.tsx formats and copies matches. Preserve native JSONPath evaluation while retrieving matched values from the lossless parse and handling duplicate-key errors. Done means the listed precision, pointer, filter, and error cases pass, along with the requested lint, test, and build commands.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug hacktoberfest help wanted

The JSON formatter's FAQ says "very large integers and high-precision decimals keep every digit" (lib/tools.ts, line 94), and Code view and Tree view do keep them. The JSONPath panel doesn't. With this JSON

{"a": 12345678901234567890, "b": 0.1000000000000000055511151231257827}

and the expression $.*, the panel shows

[
  12345678901234567000,
  0.1
]

and Copy matches copies the same rounded text. runJsonPath parses the input with the native JSON.parse (lib/jsonpath.ts, line 15), and the panel prints the matches with JSON.stringify (ConversionPanel.tsx, lines 226 and 237). Tree view had the same bug (#122).

What to do

  • Keep running the expression on the JSON.parse value, so filters work exactly as they do now.
  • Also parse the input with lossless-json's parse, and for each match take the value at its pointer from that tree. With resultType: "all" (line 23), every jsonpath-plus result already has a JSON Pointer like /items/0. Keys with / or ~ in them are escaped as ~1 and ~0, and the root is "".
  • Print the matches with lossless-json's stringify(matches, null, 2) in the panel, for both the text and Copy matches.
  • lossless-json's parse throws on a duplicate key ({"a": 1, "a": 2}), which JSON.parse accepts. Catch it and return it as the result's error, like the other modes since #218, so it doesn't crash the tool. validate (lib/json-utils.ts, line 71) already runs both parsers.
  • Please don't run jsonpath-plus on the lossless-json tree directly. A LosslessNumber is an object with value and isLosslessNumber fields, and jsonpath-plus walks into it: $..* on {"a":1,"b":{"c":2}} returns [1, {"c": 2}, "1", true, 2, "2", true], $.a.value on {"a":5} returns "5", and filters like ?(@.p === 5) and ?(@.p == @.q) stop matching.

Where to look

  • lib/jsonpath.ts: runJsonPath (line 10), the JSON.parse (line 15) and the JSONPath call (lines 20 to 25)
  • app/(tools)/json-formatter/components/ConversionPanel.tsx: the matches text (line 226) and Copy matches (line 237)
  • app/(tools)/json-formatter/components/OutputPanel.tsx: Tree view parses with lossless-json since #122 (line 153)
  • lib/__tests__/jsonpath.test.ts: the runJsonPath tests (line 5). The filter test at line 44 expects id: 1 as a plain number, so it needs updating once the matches hold lossless-json values.

Acceptance criteria

  • $.* on the JSON above shows 12345678901234567890 and 0.1000000000000000055511151231257827, in the panel and in Copy matches
  • $..* on {"a":1,"b":{"c":2}} still gives [1, {"c": 2}, 2], and $.a.value on {"a":5} still gives no matches
  • On {"items":[{"p":5,"q":5},{"p":50,"q":1}]}, $.items[?(@.p === 5)] and $.items[?(@.p == @.q)] still match the first item
  • {"a": 1, "a": 2} shows the duplicate key error and the page stays up
  • Tests for these cases
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #238 in the description.

Lingua principale
TypeScript
Stelle
1
Fork
9
Merge medio
9h 50m
PR unite (30g)
105

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/toolbelt

Tutte le issue di codercops/toolbelt

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.