News for hackers. Stuff that matters.
Re:Why I no longer have an old-school cert on my HTTPS site by matja on Friday May 23, 2025 @08:55AM (#44072443)
Aren't JSON parsers technically not following the standard if they don't reliably store a number that is not representable by a IEEE754 double precision float?

It's a shame JSON parsers usually default to performance rather than correctness, by using bignums for numbers.

Re:Why I no longer have an old-school cert on my HTTPS site by q3k on Friday May 23, 2025 @09:22AM (#44072660)
Have a read through RFC7159 or 8259 and despair.

> This specification allows implementations to set limits on the range and precision of numbers accepted

JSON is a terrible interoperability standard.

Re:Why I no longer have an old-school cert on my HTTPS site by matja on Friday May 23, 2025 @09:52AM (#44072897)
So a JSON parser that cannot store a 2 is technically compliant? :(
Re:Why I no longer have an old-school cert on my HTTPS site by q3k on Friday May 23, 2025 @10:04AM (#44072997)
Yep. Or one that parses it into a 7 :)
Re:Why I no longer have an old-school cert on my HTTPS site by kevingadd on Friday May 23, 2025 @03:18PM (#44075722)
I once debugged a production issue that boiled down to "A PCI compliance .dll was messing with floating point flags, causing the number 4 to unserialize as 12"
Re:Why I no longer have an old-school cert on my HTTPS site by xeromal on Friday May 23, 2025 @04:46PM (#44076452)
That sounds awful. lol
Re:Why I no longer have an old-school cert on my HTTPS site by chasd00 on Friday May 23, 2025 @03:41PM (#44075924)
> Or one that parses it into a 7 :)

if it's known and acceptable that LLMs can hallucinate arguments to an API then i don't see how this isn't perfectly acceptable behavior either.

Re:Why I no longer have an old-school cert on my HTTPS site by reichstein on Friday May 23, 2025 @04:42PM (#44076423)
JSON is a text format. A parser must recognize the text `2` as a valid production of the JSON number grammar.

Converting that text to _any_ kind of numerical value is outside the scope of the specification. (At least the JSON.org specification, the RFC tries to say more.)

As a textural format, when you use it for data interchange between different platforms, you should ensure that the endpoints agree on the _interpretation_, otherwise they won't see the same data.

Again outside of the scope of the JSON specification.

Re:Why I no longer have an old-school cert on my HTTPS site by tsimionescu on Saturday May 24, 2025 @02:27AM (#44079171)
A JSON parser has to check if a numeric value is actually numeric - the JSON {"a" : 123456789} is valid, but {"a" : 12345678f} is not. Per the RFC, a standards-compliant JSON parser can also refuse {"a": 123456789} if it considers the number is too large.
Re:Why I no longer have an old-school cert on my HTTPS site by deepsun on Saturday May 24, 2025 @03:39PM (#44083310)
The more a format restricts, the more useful it is. E.g. if a format allows pretty much anything and it's up to parsers to accept or reject it, we may as well say "any text file" (or even "any data file") -- it would allow for anything.

Similarly to a "schema-less" DBMS -- you will still have a schema, it will just be in your application code, not enforced by the DBMS.

JSON is a nice balance between convenience and restrictions, but it's still a compromise.

Re:Why I no longer have an old-school cert on my HTTPS site by kens on Friday May 23, 2025 @03:54PM (#44076058)
> Aren't JSON parsers technically not following the standard if they don't reliably store a number that is not representable by a IEEE754 double precision float?

That sentence has four negations and I honestly can't figure out what it means.

Re:Why I no longer have an old-school cert on my HTTPS site by umanwizard on Friday May 23, 2025 @07:03PM (#44077388)
“The standard technically requires that JSON parsers reliably store numbers, even those that are not representable by an IEEE double”.

(It seems this claim is not true, but at least that’s what the sentence means.)

Re:Why I no longer have an old-school cert on my HTTPS site by alterom on Saturday May 24, 2025 @09:24AM (#44080950)
>> Aren't JSON parsers technically not following the standard if they don't reliably store a number that is not representable by a IEEE754 double precision float?

>That sentence has four negations and I honestly can't figure out what it means.

This example is halfway as bad as the one Orwell gives in my favorite essay, "Politics the the English Language"¹.

Compare and contrast:

>I am not, indeed, sure whether it is not true to say that the Milton who once seemed not unlike a seventeenth-century Shelley had not become, out of an experience ever more bitter in each year, more alien (sic) to the founder of that Jesuit sect which nothing could induce him to tolerate.

Orwell has much to say about either.

_____

¹https://www.orwellfoundation.com/the-orwell-foundation/orwel...

Re:Why I no longer have an old-school cert on my HTTPS site by NooneAtAll3 on Saturday May 24, 2025 @01:44PM (#44082634)
that Orwell quote can be saved a lot by proper punctuation

I am not, indeed, sure*,* whether it is not true to say that the Milton *(*who once seemed not unlike a seventeenth-century Shelley*)* had not become *-* out of an experience *-* ever more bitter in each year, more alien (sic) to the founder of that Jesuit sect*,* which nothing could induce him to tolerate.

Re:Why I no longer have an old-school cert on my HTTPS site by alterom on Monday June 02, 2025 @03:27AM (#44156456)
Has the proper punctuation allowed you to see that there's an extra negation there that makes the sentence say the exact opposite of what the author intended it to say?
Re:Why I no longer have an old-school cert on my HTTPS site by NooneAtAll3 on Saturday May 24, 2025 @01:39PM (#44082589)
Aren't {X}? -> isn't it true that {X}?

{X} = JSON parsers technically [are] not following the standard if {reason}

{reason} = [JSON parsers] don't reliably store a number that {what kind of number?}

{what kind of number} = number that is not representable by a IEEE754 double precision float

seems simple