JSON to XML: one root element for top-level arrays, and keep empty and nested arrays
I maintainer di solito rispondono entro 1 giorno
@anurag2787 ci sta già lavorando.
Dal 19/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, typescript
- Ambito
- tooling
Direzione di ricerca
Inizia da toXML e dal relativo ramo per gli array in lib/json-utils.ts, poi esamina il test esistente di toXML in lib/__tests__/json-utils.test.ts. Aggiungi controlli sul testo prodotto per gli array al livello superiore, vuoti e annidati, e per i casi con oggetti invariati. Il lavoro è completato quando tutti i casi di accettazione elencati passano e l’output degli oggetti esistenti resta invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The JSON formatter's XML conversion (toXML in lib/json-utils.ts) gives broken XML when the JSON is an array, and it drops data for empty and nested arrays:
| JSON | XML now |
|---|---|
[1,2] |
two <rootItem> elements and no root element, which isn't well-formed XML |
[] |
only the <?xml ...?> line, with no element at all |
{"a":[]} |
an empty <root>, so a is gone |
{"a":[[1,2],[3]]} |
three <aItemItem> siblings, so [1,2] and [3] can't be told apart |
Objects, and arrays inside objects, are fine today: {"users":[{"id":1},{"id":2}]} gives two <user> elements inside <root>, and that should stay as it is.
Where to look
lib/json-utils.ts:toXML(line 571) and the array branch ofrender(lines 579 to 584)lib/__tests__/json-utils.test.ts: only one test touchestoXMLtoday (line 100), so add adescribe("toXML")blockapp/(tools)/json-formatter/components/ConversionPanel.tsx(line 59) is where the tool calls it
Acceptance criteria
- A top-level array gives one
<root>element with the items inside, so[1,2]gives<root>with two<rootItem>children - An empty array gives an empty element:
[]gives<root/>, and{"a":[]}gives<a/>inside<root> - An array inside an array gets its own element, so
{"a":[[1,2],[3]]}gives two<aItem>elements, the first with two<aItemItem>children and the second with one - Output for objects, and for arrays of values or objects inside objects, doesn't change
- Tests check the output text for each case above (please don't add an XML parser as a dependency)
-
npm run lint,npm run testandnpm run buildpass
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 #204 in the description.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 9
- Merge medio
- 9h 50m
- PR unite (30g)
- 105
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/toolbelt
-
JSONPath: big numbers in the results are roundedForse già presa @arxh80 l’ha presa oggi. Apertabug hacktoberfest help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
codercops/toolbelt#238 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Color converter: the contrast ratio shows `4.50 : 1` while Normal AA says FAILForse già presa @bercedev l’ha presa oggi. Apertabug good first issue hacktoberfest
codercops/toolbelt#235 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON to YAML: control characters are written raw, so PyYAML and js-yaml can't read the outputForse già presa @anurag2787 l’ha presa oggi. Apertabug good first issue hacktoberfest
codercops/toolbelt#234 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON formatter: Escape for code gives broken Python when the text has a run of single quotesForse già presa @anurag2787 l’ha presa oggi. Apertabug good first issue hacktoberfest
codercops/toolbelt#233 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Add the URL encoder to the README, the home share card and package.jsonForse già presa @Abhishek764 l’ha presa 3 giorni fa. Apertadocumentation good first issue hacktoberfest
codercops/toolbelt#153 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/toolbelt
Issue simili
-
Add: Pbs KidsApertacheck:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 2 giorni
-
maintanance
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
inmanta/web-console#7583 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
deltachat/deltachat-desktop#6881 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
[Bug Report][3.13.7] VDataTable with select-strategy="single" shows select-all checkbox in mobile modeForse già presa @lazerg l’ha presa oggi. ApertaS: triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
phivk/rubiks-lab#33 ·
I maintainer di solito rispondono entro 1 giorno