Answers for "php json_encode pretty"

PHP
0

php json pretty print

$json_string = json_encode($data, JSON_PRETTY_PRINT);
Posted by: Guest on February-03-2021
1

php json_encode pretty

<?php
header('Content-Type: application/json');

echo json_encode([
    'success' => true,
    'error' => null,
    'data' => [
        'prices' => [
            [
                
                'key' => 0,
                'duration' => 4,
                'price' => 5000,
                ],
                [
                
                'key' => 1,
                'duration' => 6,
                'price' => 7000,
                ],
                [
                
                'key' => 2,
                'duration' => 12,
                'price' => 100000,
                ],
                
                
            ]
        ]
    
    
    ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
Posted by: Guest on October-13-2021

Browse Popular Code Answers by Language