Search code examples
jsonyamlformattingformatunexpected-token

SyntaxError: Unexpected token � in JSON at position 0


I'm getting the previous error while trying to load a simple JSON file:

{
  "$schema": "http://json-schema.org/draft-04/schema#"
}

What I'm doing is trying to use act with this git action. However, even when trying to load the JSON with a dummy project it still gives me that error.

As you can see, the JSON is clearly valid, I'm not sure why it complains about that weird char in the beginning of the JSON. I double checked with this JSON validator and it says it's valid.

This was under Windows.


Solution

  • Windows introduced some weird chars in the beginning while outputting:
    generate-schema -j .\config.json > .\config.schema.json.
    I reran the command on a Linux machine.