Fixed : “Json Array should begin with [” error on UTF-8 or UTF-16 files

Problem : JSON file which store top level JSON arrays just wouldn’t parse (using org.json library), and gives out an error message like – “Json Array should begin with [ …..”. Editors like Vim or Gedit or IntelliJ show no errors (or any character before “[” )in these files.

Reason :  Byte order marker character is prefixed to the file content (this was probably added when I converted the files from UTF-16 to UTF-8).

Fix:

  1. Open the file in Vim.
  2. Run command-   :set nobomb
  3. save and exit. (:wq)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

44,547 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>