It's a BOM and I seem to remember we had the discussion before.
Purging exactly this with a regex anchored at the start of the file° is fine.
> s/.*?\[/\[/
Better: s/^\x{feff}//
But don't include the \[ in the pattern, a JSON-stream doesn't need to start with an array.
> It instead it represents them in terms of ones it has previously created. Is that about right?
that's the way how Data::Dumper handles repeated references and circular structures, in order to accurately reproduce the original data after evaluation.
from the DESCRIPTION:
The return value can be evaled to get back an identical copy of the original reference structure. (Please do consider the security implications of eval'ing code from untrusted sources!)
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
°) NB I don't recommend deleting any BOMs elsewhere, they could have a meaning. And if they really caused an error this should be investigated thoroughly. A BOM at the file's start (and only there) is often added automatically by many programs.
In reply to Re: Rogue character(s) at start of JSON file (BOM; dumping references)
by LanX
in thread Rogue character(s) at start of JSON file
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |