Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
devRancid636337dIt'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 -
usr--2ndry743337d@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. -
Demolishun34957337dI don't think we want json parsers to try and "fix" malformed json. It should just reject.
-
sleepyObjobjobj266336dyou're allowed to pronounce it any way you want. just like how you're allowed to be wrong
-
IntrusionCM14955336dJSON 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.
Related Rants
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"?
rant
jsonlint
json