david284 / ModuleDescriptor

VLCB/CBUS Module descriptor format & examples
0 stars 2 forks source link

Bools within quotes #9

Closed RichardCrawshaw closed 3 months ago

RichardCrawshaw commented 3 months ago

There are a large number of instances where there are Boolean values that have been put within quotes. If the value is to be interpreted as a Boolean then this is incorrect JSON. Boolean is a valid JSON data-type, and should be represented without quotes. (The exception is when the word 'true' or 'false' is wanted, then they should be quoted, but they cease to be Boolean.) In addition there are other instances for the same containing element type where the Boolean value has not been put within quotes. This makes it impossible to construct a JSON object type that can be used by a serialiser to deserialise the JSON text. The serialiser throws an exception when it finds a string when it's expecting a Boolean, and when it finds a Boolean when it's expecting a string.

RichardCrawshaw commented 3 months ago

The files in question are all the CANMIO and CANMIO-SVO; Not CANMIO-OUT.

RichardCrawshaw commented 3 months ago

There are a large number of similar issues where numbers have been put within quotes. Again these are in the CANMIO files, and relate to the "nv" element within the "overload" element.

david284 commented 3 months ago

NodeJS (and I suspect javascript in general) allowed me to wallow in my blissful ignorance of this - but checking ECMA-404, you're absolutely correct, quote marks should be reserved for strings It's not the first time I've been caught out by Javascript allowing (and working) with things that a 'strongly typed' language like C# wouldn't allow

RichardCrawshaw commented 3 months ago

JS is extremely good at that; it's both its great strength and its great weakness!