Created
December 26, 2018 06:24
-
-
Save parzibyte/50aca03f78d5ed0188dd75ba12a84410 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 | |
# Esto puede venir de cualquier lugar, aquí lo ponemos en una variable directamente | |
$codificado = '{"idCuenta":"123ASD","cliente":"parzibyte","saldo":250,"movimientos":[{"tipo":"salida","monto":125,"fecha":"2018-12-25","involucrados":{"nombre":"Un nombre","idCuenta":"456465"}},{"tipo":"salida","monto":666.55,"fecha":"2018-12-26"}]}'; | |
$decodificado = json_decode($codificado); | |
// Comprobamos si no devolvió NULL: | |
if($decodificado === NULL){ | |
echo "Error decodificando"; | |
}else{ | |
// Podemos acceder a las propiedades | |
echo "El cliente es: " . $decodificado->cliente; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment