JSON, I hardly know 'er
Vložit
- čas přidán 26. 06. 2024
- Twitch
Everything is built live on twitch
Twitch : bit.ly/3xhFO3E
Discord: discord.gg/ThePrimeagen
Spotify DevHour: open.spotify.com/show/4MLaDrQ...
Editor
All my videos are edited by Flip. Give him a follow! / flipmediaprod He is also open to do more editing, so slide deeeeeeeeep into his dms.
Join this channel to get access to perks:
/ @theprimeagen
Links
Linode: linode.com/prime
/ discord
Twitch: / theprimeagen
Insta: / theprimeagen
Twitter: / theprimeagen
VimRC & i3: github.com/ThePrimeagen/.dotf...
Keyboard 15% off bit.ly/Prime360 USE CODE PRIME360
#coding #neovim #typescript #programming #vim #softwareengineering #codinglife #webdesign #webdevelopment #webdev #javascript #rustlang #rust #twitch #twitchstreamer #programmerhumor #codinghumor #software #softwareengineer #softwaredeveloper #softwaredevelopment - Věda a technologie
This game started with "i don't know json" and ended with "okay, i dont even know js"
this hits so much jajajaja
JS is like the meaning of life. We'll never fully know
I’d argue JSON and whatever that mess of a JSON implementation in JS are are two different things.
Exactly. Using JSON with Java or Go is s different story
That's what I was thinking as well
hjson my beloved
@@dejangegic using JSON with Go is even worse because of the zero-values??? Imagine writing a struct with pointers just to check if the value was set.
I’m using JSON in C with some tiny ass library for embedded. It’s sweet, if you parse a broken json it just seg faults
“What possibly can be so difficult about JSON?”
After the video I cried in the corner.
At least you know how to inject dependencies in Spring Boot. I actually didn't know about the @Lookup one, so thank you for that hidden gem!
@@CottidaeSEA Thank you, happy to hear it :)
🤣🤣🤣
Honestly, JSON is pretty reasonable. Javascript, on the other hand, has the worst edge cases. It's like, a stack of knives; nothing but edges.
I feel like half of this video is inspired by me pointing out why I use null in JS.
that is... maybe a good argument
@@ThePrimeagen im curious to know who is json and why is he so important
James "Json" Jansoon
@@andre_julius that explains alot
I use undefined and null. I consider myself a rebel. A revolutionary of sorts.
No, but basically they just have different use cases. Null is for when you want something to be defined but without value and undefined when undefined, basically saying "this doesn't exist anymore". They are very different.
This is more about how Javascript handles JSON than JSON itself. Most of these were about how the JSON library handles undefined/null/edge cases that don't exist in other languages, and depend on the library you use. All this to say, I did terribly.
NaN and Infinity do exist in other languages. They are part of the Hardware IEEE implementation of floating point numbers. They just don't exist in javascript and every implementation is forced to do something different with it, because there is no solution according to the js specification.
@@krux02They do exist in JavaScript, it's just that the JSON spec has nothing to say about them. So it ends up being a convention of the library. Some will reject them, others will turn them into a string like "-Infinity", others use null... I don't like it.
Similar issues with numbers, JSON essentially allows arbitrary precision numbers, but most libraries won't handle it, including JS, which just turns it into a 64-bit float. I updated our library to support full 64-bit signed and unsigned integers, but can't do the same for floating points, because exactly (bitwise) reproducing 64-bit floats is impossible in JSON numbers (different NaNs).
The single fact that JSON has his own native class on JavaScript with just two methods should have already told you that something was fishy over there
Well, it’s not a class, it’s a global object
@@Bozon671_Higgs A Class is an object therefore nobody cares
It is better to parse JSON than just calling eval.. Eval is Evil..
I absolutely loved this video and hated it so much at the same time thanks for this awesome content
Tell me... how many did you ackshually get wrong?
DONT LIE
0 because I don't program😎
2
5
JSON spec allows for duplicate keys.
so what will JSON.parse('{"x":1 ,"x":2}') return ?
TOO MANY OKAY?? :'- (
i laughed out loud when you said "don't worry it's not going to get any easier"!
The dude has great comedic delivery.
The video had me rolling from the getgo.
I hate this game that we're playing
makes me feel things i shouldn't feel
Fun fact the JSON global object with parse and stringify was once a library by the Chuck Norris of Javascript, Doug. Browsers just made it native. At the time, it was a security concern that some devs were just doing eval()!
love this format, thx!
no i think this is just great - you're never bored, because every time you get something new!
Love this and yesterday's as well. It's software content for software folks, challenging and instructing us as professionals rather than most "coding content" which assumes we know nothing.
Jason is a rude anyway. I don't wanna know about him. *sobs*
yeah jason, you need to make up for your actions
I feel as though JSON doesn’t even know JSON with that parsed stringify coming back with an error. 😅
who knows whats even happening in there
I really like the way you commented on the solutions. Thanks for the entertaining video :)
one of the best pieces of content on the internet
It gets even more fun when you try to stringify a sparse array.
My morale is now undefined.
We need more games like this one, keep em coming
I actually knew like half of them. I went into this thinking I might know a couple.
thats pretty good
Are those behaviors in the spec? Meaning other json parsers should implement them? Sounds more like a JavaScript WAT instead of JSON.
This is something I want to know as well
I think it's both.
Given that I’ve worked on static compiled languages and JavaScript, I would lean towards JavaScript been the problem as JavaScript wants to communicate objects as trees that can be shared across other web layers.
Static compiled languages with serialization and deserialization implementations enforce the idea of a developers making their own abstraction to deal with how they want objects to communicate across boundaries as opposed to JS wanting it to put it as a “standard library” for lack of a better term.
Both EMC404 and RFC8259 explicitly do not permit NaN or Infinity for example.
I would expect an implementation according to those specifications to throw an error.
It's not only JavaScript though. For example in the python standard library you have things like json.loads("Infinity") == math.inf
I wish there was a way to json.dumps(indent=4) which would keep composite values with no composite elements in them on one line.
I’m extremely new to programming and I know nothing about JavaScript or JSON and I’m angry about this
yes, it should
The swamp seeps into the shed built on top of it
you shattered my confidence with JSON lol
Simply enlightening for me and my channel! 💪
Wait a minute BIG SAUCE, that property is private, you little mischief
best part is, that private in ts doesnt :)
That's actually a fair point, why doesn't it auto-convert it to private modifier, we must consult the overflows
"Somehow, I'm not upset" - Yeah, same here Prime.
Some of these really feel like they're not the issue of the json specification but of the JS serialiser 😅
it just might be
@@ThePrimeagen doesn't make this any less confusing / fun to guess 😂 Maybe another video with some JS type coercion fun?
I was a NodeJS developer advocate for Couchbase, a JSON database company. I did well. I got 4 Wrong, but I feel this wasn't really a good test of how will you know JSON, but still interesting
Then what can be potentially a good test for json ?
Did you know of the {foo: undefined} one? I haven't stumbled upon it but it looks painful. If x is undefined and {foo:x}
@@theodorealenas3171 It's just {}. Doesn't matter if it's a variable or not, it's value-based so if it's undefined, it's undefined.
This video made me physically ill.
9/10. Would smash like button again.
"Ha ha, nerd..."
*Continues furiously taking notes*
Whenever you said "Good job" , my disappointment was immeasurable.
hahahahahha
Most underrated programming channel
JSON: "never let them know your next move"
Thank you, Mr. ThePrimeagen!
This is why JS has more bugs than C
Truth
😂 that was fun, you should do more videos like this
That’s more about the absurdity of JavaScript and it’s JSON module and less about JSON.
Oddly satisfying how this guy is shooting against everything and everyone (except for Rust). Keep on going! :D
yayaya! i can shit on rust too!
@ThePrimeagen go and use assembler then!!
i don’t get it. why is the A missing from this programming language?
This was a fun video format.
this was.... interesting and very entertaining
This is awesome! Now i know what to ask candidates in an interview for a junior FE position at our company!
This makes sense, and is not weird at all but still thanks for the entertainment
Title:- you don't know JSON
The video:- you know nothing, John snow ❄️
I came in rocking like: JSON? It's easy, I'm 100% getting all of them right after I got the first one right, and then I left depressed...
haha
Good video and I got 0 correct. :(
hahahah
@@ThePrimeagen the problem is I mostly do gamedev with canvas api in js so I never have to deal with json
I'm shooketh
This was so funny. I work with JSON every day but I got absolutely destroyed. 😅
Man, it's like the "Wat" talk all over again. This language is full of surprises
rocket::serde::json::Json. All the JSON I really need to know.
that was a fun one, thanks!
Maybe my take on this is a weird one,
I feel like many of these questions were not even json related except for maybe the last 3.
Sure you parse them through json stringify and parser but the actual values that you used are not really json but more like random strings...
As the notation itself states "Javascript Object Notation" just because you give the json parser 353454364566 to parse it doesn't mean its json.
Personally, I'd rather that it failed on anything other than an object/array literal...
That's indeed a weird take. Numbers and strings are JSON, there's nothing on the standard saying the root element has to be non primitive
@@inakiarias7465 Oh snap, really? Well now it makes complete sense. Thanks for the clarification!
I guess this comes from the fact that JS is completely detached from reality
This is like that WAT presentation by destroy All software on JavaScript type conversion conundrums. 10 years later and we're still roasting JavaScript.
Bro humbled everyone
TOM the genius knows JSON like no other #JDSL
Json Statham approves.
The transporter
@@ThePrimeagen I was thinking more along the lines of 'snatch', not that it is related but because it's a good movie.
This made my day. 😂
"JavaScript, 💩, an embarrassing toy language used exclusively to build things it's not supposed to."
Fireship quote
a man of culture i see
Only two wrong, a couple guesses though. That's honestly a fun format, you should do it with other APIs as well. (Or one about JS wat-ness)
Thankfully I've never seen this in an interview! I failed 😭
pov: programming gremlin laughs at you as you get a perfect 0% on your job screening
This video proved me that I did not know that JSON even exist.
This video is one of the reason of my chronic insomnia
Well I did a mediocre job, so I'm happy with it :) But I've been inspired to make a JSON data set of the NIST-CSF categories and build an interactive web app. My goal is to leverage that data set to track a current and target NIST profile. This is my first real web project from scratch and I'm doing it all in vim! Thanks for the inspiration!
What could be better than javascript? Using javascript logic to transfer your important data!
Might aswell use smoke signals at that point.
Subtitles:- you don't know JSON
The video:- you know nothing, John snow ❄️
Man, you're pure comedy
"does my ai bot even json?" thats d question
You got me with some, but I noticed the last one was a string so at least I feel a little proud since I havent failed miserably 😂
LETS GO :)
I appreciate the title of this video lol
Love you bro😛
Keep rocking
Love this. More plz
I got 10 of them very confidently and I feel absolutely filthy for that.
you filthy filthy internet person
Just had surgery today. Laughing hurts. Laughed at this video. Love hurts.
wow i love js even more now
Even though i created a parser and stringifier i still got undefined as an element in array and undefined as value in object switched, this is why i try not to have anything that could be undefined while stringifying something
im having an existential crisis
it was as entertaining just as much as painful it was
The most interesting thing about JSON isn't its syntax, but its data model, imo:
object literals, array literals, the two boolean values, numbers, strings, and finally, null.
Once you realize how this core's constructs compose, it doesn't take long to figure out how to collapse the whole concrete JSON syntax down to these selected two *only* : array literals and strings (besides inert whitespace, okay)
E.g.:
{ "a": true, "b": [ 1 2 3 ], "c": null, "d": "Done!" }
Can become, with the ad-hoc conventions:
[ ["a" "b:true"] ["b" [ [ ] "n:1" "n:2" "n:3" ] ["c" "" ] [ "d" "s:Done!" ] ]
(Which is also nothing but a special flavor of S-expression in which the JSON data model is thus encoded.)
But the latter "LISP-ish" simpler lexicon and grammar (with 3 distinct lexical token classes only) then come at the cost of extra verbosity in instances of that "collapsed JSON", obviously.
JSON Statham is the stronkest! 💪😎
Okay it was entertaining
wp, Jesón.
a spiritual sequel to 'wat'
I like this style of roast the viewer and teach them
;)
@@ThePrimeagen big admirer man thanks for all the efforts 🙌
Interview questions be like...
Good format. It was a rollercoaster of emotions, I felt like a genius then like a complete idiot 3 seconds after.
PS: Are you planning on making a video on LazyVim?
Love u ❤️ u are the very best
i am thinking about some fun things :)
@@ThePrimeagen FOLKEEEEEEEEE
Last one was the Only one I got correctly with confidence
When I'm declaring variable / state first time, I'm just using null if this isn't a global variable, it's handy for me also with optional chaining it's a heaven.
This video caused me physical pain
Js is a dumpster fire 🔥🔥🔥
i am internally screaming
I just know one day, maybe years from now, one of these nice lil quirks is going to ruin my day.
Lols, jokes on you for giving easy test questions
More arguments about JS being horrible than it being about json
thats always his point
@@dgcp354 ah okay haha didnt know that