Je suis un nouveau membre
J'ai un sérieux problème avec la fonction json_decode().
Il me retourne NULL quand je lui transmet mon fichier json.
Au faite il n'arrive pas à extraire le contenu du fichier json que je lui passe.
SOS aide s'il vous plait.
Voila mon fichier json:
Code : Tout sélectionner
{"orders":[{"id_commande":44,"date":"2013-11-26T10:30:00","status":"Waiting","customerName":"ok","delivery":"ok","deliveryCompanyName":"Mp","deliveryAddress" Rennequin ","deliveryPostcode":"75","deliveryCity":"Paris","deliveryCountry":"France","billingName":"B S","billingCompanyName":"Mp","billingAddress":"Rennequin ","billingPostcode":"750","billingCity":"Paris","billingCountry":"France","products":[{"image":"products_no_image_Medium.jpg","title":"Bracelet","brand":"HIPANEMA","quantity":1.0,"price":15,"productId":24,"offerId":13}],"totalPrice":15,"productsCount":1},{"id_commande":4462,"date":"2013-11-26T10:35:00","status":"Waiting","customerName":"BS","deliveryName":"B","deliveryCompanyName":"Mp","deliveryAddress":"ok","deliveryPostcode":"75","deliveryCity":"Paris","deliveryCountry":"France","billingName":"BS","billingCompanyName":"Mp","billingAddress":"ok ","billingPostcode":"75","billingCity":"Paris","billingCountry":"France","products":[{"image":"products_no_image_Medium.jpg","title":"Tropez","brand":"HIPA","quantity":2.0,"price":15,"productId":25,"offerId":133522}],"totalPrice":300,"productsCount":2}],"recordsReturned":2,"totalRecords":2,"startIndex":1,"sort":0,"pageIndex":1,"pageSize":50}Je récupère le contenu du fichier avec file_get_contents() et je l'affecte a la variable $data.
$valeur=json_decode($data,true);
var_dump($valeur);// on m'affiche NULL
Pourtant la structure de mon fichier json est correcte.(sur http://www.functions-online.com/json_decode.html il m'affiche correctement le résultat).
Présentement je suis bloqué j'ai vraiment besoin de votre soutient.
Merci