0

I am creating a install script for Sensu on Windows and am getting this error upon starting the service:

{
  "timestamp": "2016-04-14T23:05:45.043371+0100",
  "level": "warn",
  "message": "config file must be valid json",
  "file": "C:/opt/sensu/conf.d/client.json",
  "error": "unexpected character at line 1, column 1 [parse.c:652]"
}

This error is given on all JSON config files.

Here is my install script which successfully installs the msi and writes the files how I want them: http://pastebin.com/GgQsNcAX

Here is an example of a config file it output:

{
    "client": {
        "name": "Server1",
        "address": "1.1.1.1",
        "subscriptions": [ "none" ]
    }
}

Symbols:

JSON CRLF Symbols

Looks fine to me !?

ZZ9
  • 888
  • 3
  • 16
  • 47

1 Answers1

0

Suggestion: Use a hex editor to look at the file. You may find a rogue FE FF at the file head; this is a byte order marker for Unicode, and does not show in Unicode-aware text editors. Notepad, by the way, is Unicode-aware. (You'll also find, in this case, that your curly brace instead of being 0x7B, is actually 0x00 0x7B.)

CharlesW
  • 31
  • 5
  • That's notepad++, yes? notepad++ is also Unicode-aware, and won't show a BOM. There is a hex display tool that you can use... Plugins | Converter | ASCII->Hex. Might be worth a try... – CharlesW Apr 15 '16 at 15:08
  • My bad, let me get back to you – ZZ9 Apr 15 '16 at 16:29