Are you suggesting that if the JSON stream has a double and an Int is requested then it should throw an error?
Oh no, definitely not that.
I mean what if the User requests:
— the string “Hello” as a DBL? Is this NaN, zero, or an error? What about as an Int32? A timestamp?
— for that matter, what about a boolean? Should anything other than ‘true’/‘false' be an error? Any non-‘null'/non-‘false' be true (including the JSON strings “null” and false”)? Or any non ‘true' be false (even the JSON string “true”)?
— “1.2Hello” as a DBL? Is this 1.2 or an error?
— or just “1.2”, a JSON string, not a JSON numeric? Should we (as we are doing) allow this to be converted to 1.2?
— a JSON Object as an Array of DBL? A “Not an array” error, or an array of all the Objects items converted to DBL?
— a JSON Scalar as an Array of DBL? Error or a single element array?
— a JSON Object as a DBL? Could return the first item, but Objects are unordered, so “first” is a bit problematic.
And what if the User asks for an item by name from:
— an Object that doesn’t have that named item? Currently this is no error, but we have a “found” boolean output that is false.
— an Array or Scalar? Could be an Error, or just return false for “found”.
Then for the JSON to Variant function there is:
— cluster item name not present in the JSON Object: an error or return the default value
Personally, I think we should give as much “loose-typing” as possible, but I’m not sure where the line should be drawn for returning errors.