rfc:json_encode_indentation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:json_encode_indentation [2021/06/03 13:57] – tdgroot | rfc:json_encode_indentation [2022/07/04 18:19] – Change status to Voting tdgroot | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2021-06-03 | * Date: 2021-06-03 | ||
* Author: Timon de Groot, tdegroot96@gmail.com | * Author: Timon de Groot, tdegroot96@gmail.com | ||
- | * Status: | + | |
+ | | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 9: | Line 10: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Introducing a 4th parameter, called //indent//. The type of the parameter is string|int and its default value is 4. | + | Introducing a 4th parameter, called //indent//. The type of the parameter is int and its default value is 4. |
- | When a string is passed, that character sequence will be used for indentation, where it normally would be ' | + | By default, an indentation |
- | When an int is passed, an indentation of N spaces will be applied. | + | When the //indent// parameter |
<code php> | <code php> | ||
$data = [ | $data = [ | ||
' | ' | ||
- | ' | + | ' |
]; | ]; | ||
+ | echo json_encode([' | ||
echo json_encode($data, | echo json_encode($data, | ||
- | echo json_encode($data, | ||
?> | ?> | ||
</ | </ | ||
- | < | + | < |
+ | { | ||
+ | " | ||
+ | } | ||
{ | { | ||
" | " | ||
" | " | ||
- | | + | 2 |
- | 1, | + | |
- | | + | |
- | 3 | + | |
] | ] | ||
- | } | ||
- | { | ||
- | 🚀" | ||
- | 🚀" | ||
- | 🚀🚀0, | ||
- | 🚀🚀1, | ||
- | 🚀🚀2, | ||
- | 🚀🚀3 | ||
- | 🚀] | ||
} | } | ||
</ | </ | ||
Line 59: | Line 51: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Tests are written with the RFC | Tests are written with the RFC | ||
+ | |||
+ | ===== Vote ===== | ||
+ | |||
+ | Voting opened on 2022-07-01 and closes on 2022-07-15. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ |
rfc/json_encode_indentation.txt · Last modified: 2022/07/19 15:23 by cmb