guibranco/BancosBrasileiros

JSON syntax error when deserializing with json_decode in PHP

pferreirafabricio opened this issue · 1 comments

Describe the bug
When trying to deserialize the JSON with only the json_decode function in PHP is thrown an error of 'syntax error'.

To Reproduce

$jsonPath = __DIR__ . "/vendor/guibranco/bancos-brasileiros/data/bancos.json";

$content = file_get_contents($jsonPath);
$data = json_decode($content, true);

Expected behavior
Deserialize without errors and not any additional work.

Desktop (please complete the following information):

  • OS: Windows 10
  • Package Version: 4.0.192

Additional context
I get this working by doing this (from this answer in StackOverflow):

$jsonPath = __DIR__ . "/vendor/guibranco/bancos-brasileiros/data/bancos.json";

$content = file_get_contents($jsonPath);
$data = json_decode(preg_replace('/[[:^print:]]/', '', $content), true);

I will pick this one and fix it!

Thanks for the report @pferreirafabricio