2

JsonLint ParsingException "composer.json does not contain valid JSON" is an incorrect statement. The file contains 99% valid JSON except for 1 incorrect character which is correctly pointed out as an "Invalid string, it appears you have an unescaped backslash at: \-dev".

And why do people in tutorials keep calling it "Jay's on" instead of "Jason" like "Jackson"? I can only imagine what they would call the "King of Pop" musician ... "my cal Jack's Onn"?

Comments
  • 2
    It's a correct statement. Valid = 100%
    Some linters can parse it differently for better error reporting but the whole file is still invalid json if even a tiny part is wrong
  • 0
    @devRancid "contains" meaning:

    > have or hold (someone or something) within.

    > "the cigarettes were thought to contain cannabis"

    In this example quoted from Oxford Languages dictionary, the cigarettes do not consist 100% of cannabis, the only contain some cannabis.
  • 2
    I don't think we want json parsers to try and "fix" malformed json. It should just reject.
  • 0
    "have or hold" can also refer to the whole text "within" a file
  • 0
    you're allowed to pronounce it any way you want. just like how you're allowed to be wrong
  • 2
    JSON is - like many other formats - usually seen as a stream of tokens. Not characters.

    A token can be a single character, but first and foremost it is a token or element.

    If all tokens / elements match the spec, the stream is valid. If a single token / element does not match the spec, invalid.

    So to be a pendantic nutjob:
    composer.json does contain [at least one] invalid JSON [token / element].

    A parser parses, a validator validates.

    Two different things. A parser just stops on first error usually, a validator tries to find as many errors as possible.

    Thus the exception is right - its just not fully spelled out, as that is too long and outside the scope of any parser imho.

    But lovely rant.
Add Comment