php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #76005 Ability to specify indentation string for json_encode with JSON_PRETTY_PRINT
Submitted: 2018-02-24 19:16 UTC Modified: 2018-06-05 11:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: cmanley at xs4all dot nl Assigned:
Status: Open Package: JSON related
PHP Version: Next Minor Version OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cmanley at xs4all dot nl
New email:
PHP Version: OS:

 

 [2018-02-24 19:16 UTC] cmanley at xs4all dot nl
Description:
------------
The indentation string is currently hard coded as can be seen here:
https://github.com/php/php-src/blob/master/ext/json/json_encoder.c#L86

It'd be nicer for users to be able to specify what they want to use for indentation, e.g. more or less spaces or tabs.

To achieve this, a 4th optional parameter will need to be added to json_encode (as it must not be a global setting), or a built in JSON encoder class can be created in which extra features such as indentation can be set per instance.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-05 11:11 UTC] bukka@php.net
-Package: json +Package: JSON related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 08:01:30 2024 UTC