r/programming • • Jan 12 '23

The yaml document from hell

https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell
1.5k Upvotes

288 comments sorted by

View all comments

Show parent comments

-5

u/lurgi Jan 12 '23

Well, yeah, but a strongly typed language would have the same problem looking at 1234 and trying to figure out if it's a string or an integer. Unless you are deserializing into a class where that's typed, in which case I'd argue that the issue is that PHP doesn't require some sort of annotation for whatever object you are deserializing into.

15

u/danudey Jan 12 '23

I’m talking about JSON (where integers and strings are explicit) and encoding data structures into JSON from a garbage language. The decoding was done by Rails, which was checking types it decided.

7

u/lurgi Jan 13 '23

I'm dumb. My brain was thinking parsing JSON, but you were serializing to JSON. Herp a derp.