Created
December 26, 2018 05:46
-
-
Save parzibyte/bb5e88d8fca14fa528151fbcc8c87b00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Un objeto con flotantes para ver las tabulaciones y obligar a mantener el cero | |
$objeto = [ | |
"idCuenta" => "123ASD", | |
"cliente" => "parzibyte", | |
"saldo" => 250.0, | |
"movimientos" => [ | |
[ | |
"tipo" => "salida", | |
"monto" => 125.0, | |
"fecha" => "2018-12-25" | |
], | |
[ | |
"tipo" => "salida", | |
"monto" => 666.55, | |
"fecha" => "2018-12-26" | |
] | |
] | |
]; | |
echo json_encode($objeto, JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION); | |
/* | |
{ | |
"idCuenta": "123ASD", | |
"cliente": "parzibyte", | |
"saldo": 250.0, | |
"movimientos": [ | |
{ | |
"tipo": "salida", | |
"monto": 125.0, | |
"fecha": "2018-12-25" | |
}, | |
{ | |
"tipo": "salida", | |
"monto": 666.55, | |
"fecha": "2018-12-26" | |
} | |
] | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment