note 115293 deleted from function.json-decode by mazzanet

From: Date: Tue, 01 Jul 2014 07:48:45 +0000
Subject: note 115293 deleted from function.json-decode by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199794@lists.php.net to get a copy of this message
Note Submitter: neo-blaster at hotmail dot fr ---- Hi All, I encountered the same issue with json_decode() from valid JSON file. I try differents solutions suggested by users but nothing works for me whereas this strange solution. So i add this note for users who wants to try my solution. I put my file in ANSI encoding with these few following lines codes. -------------{ File : myJsonFile.json [encoding : ANSI] }-------------- ----------------------------------------------------------------------- { "Property1" : "value1", "Property2" : "value2" } ----------------------------------------------------------------------- ----------------------------------------------------------------------- AND -----{File : myPHPFileWhichNeedJSON.php [encoding : ANSI] }---- --------------------------------------------------------------- $fileContent = file_get_contents('myJsonFile.json'); $obj = json_decode($fileContent, true); print_r($obj); --------------------------------------------------------------- --------------------------------------------------------------- Print_r return : -------------------- Array ( [Property1] => value1 [Property2] => value2 ) Notes : ---------- - First I try to change PHP File encoding -> No change - I try to put my JSON File in UTF-8 -> Nothing -> I use Notepad++ to define file encoding Informations : ------------------- - phpversion() -> 5.3.28 Neoblaster.

« previous php.notes (#199794) next »