php / php/php-src

JSON pretty printing indentation using tabs or double spaces

Aperta
#8,864 8 commenti 13 reazioni 1 assegnatario Vedi su GitHub

@bukka ci sta già lavorando.

Dal 29/7/2022.

Extension: json Feature Status: Requires RFC
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

The current indentation of pretty printed JSON with json_encode() is using 4 bytes per level.
I feel we are lacking the ability to choose intendation type, i.e. for optimization.

Example:

  • Tab (1 bytes)
  • Two spaces (2 bytes)
  • Four spaces (4 bytes)

Maybe by setting a flag to either:
JSON_PRETTY_PRINT
JSON_PRETTY_PRINT_TABS
JSON_PRETTY_PRINT_DOUBLE_SPACES

I know that we can preg_replace() it the way we want. But why waste resources if we could have it at the core.

Guida per i contributori

Apri la guida per i contributori

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.