Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

JSONPath: big numbers in the results are rounded

Abierto
#238 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@arxh80 ya está trabajando en esto.

Desde el 21/10/2026.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nextjs, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
9
Merge medio
9 h 50 min
PR fusionados (30 d)
105

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codercops/toolbelt

Todos los issues de codercops/toolbelt

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.