JSON, I hardly know 'er

Sdílet
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

Komentáře • 565

  • @tesla1772
    @tesla1772 Před rokem +1846

    This game started with "i don't know json" and ended with "okay, i dont even know js"

  • @FlorianWendelborn
    @FlorianWendelborn Před rokem +896

    I’d argue JSON and whatever that mess of a JSON implementation in JS are are two different things.

    • @dejangegic
      @dejangegic Před rokem +77

      Exactly. Using JSON with Java or Go is s different story

    • @BurgerKingHarkinian
      @BurgerKingHarkinian Před rokem +5

      That's what I was thinking as well

    • @cerulity32k
      @cerulity32k Před rokem +2

      hjson my beloved

    • @fenkraken
      @fenkraken Před rokem +26

      @@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.

    • @hansdampf2284
      @hansdampf2284 Před rokem +71

      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

  • @techwithattila
    @techwithattila Před rokem +211

    “What possibly can be so difficult about JSON?”
    After the video I cried in the corner.

    • @CottidaeSEA
      @CottidaeSEA Před rokem +1

      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!

    • @techwithattila
      @techwithattila Před rokem +1

      @@CottidaeSEA Thank you, happy to hear it :)

    • @rajesh_404
      @rajesh_404 Před rokem

      🤣🤣🤣

    • @SemiMono
      @SemiMono Před 4 měsíci +1

      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.

  • @JamesJansson
    @JamesJansson Před rokem +404

    I feel like half of this video is inspired by me pointing out why I use null in JS.

    • @ThePrimeagen
      @ThePrimeagen  Před rokem +110

      that is... maybe a good argument

    • @barry4207
      @barry4207 Před rokem +42

      @@ThePrimeagen im curious to know who is json and why is he so important

    • @andre_julius
      @andre_julius Před rokem +44

      James "Json" Jansoon

    • @babudelhi9885
      @babudelhi9885 Před rokem +5

      @@andre_julius that explains alot

    • @CottidaeSEA
      @CottidaeSEA Před rokem +12

      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.

  • @Tresla
    @Tresla Před rokem +101

    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.

    • @krux02
      @krux02 Před rokem

      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.

    • @Aidiakapi
      @Aidiakapi Před 5 měsíci

      ​@@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).

  • @AntonioGonzalez-we4wx
    @AntonioGonzalez-we4wx Před rokem +265

    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

    • @Bozon671_Higgs
      @Bozon671_Higgs Před rokem +23

      Well, it’s not a class, it’s a global object

    • @heavenstone3503
      @heavenstone3503 Před rokem

      @@Bozon671_Higgs A Class is an object therefore nobody cares

    • @savagesarethebest7251
      @savagesarethebest7251 Před rokem +4

      It is better to parse JSON than just calling eval.. Eval is Evil..

  • @alexodan
    @alexodan Před rokem +51

    I absolutely loved this video and hated it so much at the same time thanks for this awesome content

  • @ThePrimeagen
    @ThePrimeagen  Před rokem +13

    Tell me... how many did you ackshually get wrong?
    DONT LIE

  • @steveyoo9342
    @steveyoo9342 Před rokem +5

    i laughed out loud when you said "don't worry it's not going to get any easier"!

  • @coolworx
    @coolworx Před rokem +6

    The dude has great comedic delivery.
    The video had me rolling from the getgo.

  • @tanishqsingla9492
    @tanishqsingla9492 Před rokem +10

    I hate this game that we're playing

  • @4.0.4
    @4.0.4 Před rokem +4

    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()!

  • @marcelofernandez6561
    @marcelofernandez6561 Před rokem

    love this format, thx!

  • @objectobject255
    @objectobject255 Před rokem

    no i think this is just great - you're never bored, because every time you get something new!

  • @mharbol
    @mharbol Před rokem +4

    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.

  • @ContraHacker1337
    @ContraHacker1337 Před rokem +4

    Jason is a rude anyway. I don't wanna know about him. *sobs*

    • @ThePrimeagen
      @ThePrimeagen  Před rokem +1

      yeah jason, you need to make up for your actions

  • @jd4codes
    @jd4codes Před rokem +3

    I feel as though JSON doesn’t even know JSON with that parsed stringify coming back with an error. 😅

  • @thehibbi
    @thehibbi Před rokem +1

    I really like the way you commented on the solutions. Thanks for the entertaining video :)

  • @hszt4414
    @hszt4414 Před rokem

    one of the best pieces of content on the internet

  • @grumpylibrarian
    @grumpylibrarian Před rokem +1

    It gets even more fun when you try to stringify a sparse array.

  • @HansLemurson
    @HansLemurson Před rokem +1

    My morale is now undefined.

  • @megamind452
    @megamind452 Před rokem +1

    We need more games like this one, keep em coming

  • @CottidaeSEA
    @CottidaeSEA Před rokem +7

    I actually knew like half of them. I went into this thinking I might know a couple.

  • @IgorGuerrero
    @IgorGuerrero Před rokem +17

    Are those behaviors in the spec? Meaning other json parsers should implement them? Sounds more like a JavaScript WAT instead of JSON.

    • @sodreigor
      @sodreigor Před rokem +3

      This is something I want to know as well

    • @yuri0001
      @yuri0001 Před rokem +1

      I think it's both.

    • @georgeokello8620
      @georgeokello8620 Před rokem

      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.

    • @hoomodance
      @hoomodance Před rokem +1

      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

  • @jsalsman
    @jsalsman Před rokem +8

    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.

  • @its_finn96
    @its_finn96 Před rokem +3

    I’m extremely new to programming and I know nothing about JavaScript or JSON and I’m angry about this

  • @danielschmider5069
    @danielschmider5069 Před rokem

    The swamp seeps into the shed built on top of it

  • @despareint
    @despareint Před rokem

    you shattered my confidence with JSON lol

  • @coderstubechannel
    @coderstubechannel Před rokem +1

    Simply enlightening for me and my channel! 💪

  • @beriu3512
    @beriu3512 Před rokem +2

    Wait a minute BIG SAUCE, that property is private, you little mischief

    • @ThePrimeagen
      @ThePrimeagen  Před rokem

      best part is, that private in ts doesnt :)

    • @beriu3512
      @beriu3512 Před rokem

      That's actually a fair point, why doesn't it auto-convert it to private modifier, we must consult the overflows

  • @ambuj.k
    @ambuj.k Před rokem

    "Somehow, I'm not upset" - Yeah, same here Prime.

  • @Ma1ne2
    @Ma1ne2 Před rokem +6

    Some of these really feel like they're not the issue of the json specification but of the JS serialiser 😅

    • @ThePrimeagen
      @ThePrimeagen  Před rokem +3

      it just might be

    • @Ma1ne2
      @Ma1ne2 Před rokem

      @@ThePrimeagen doesn't make this any less confusing / fun to guess 😂 Maybe another video with some JS type coercion fun?

  • @EricBishard
    @EricBishard Před rokem +8

    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

    • @RudraSingh-pb5ls
      @RudraSingh-pb5ls Před rokem +3

      Then what can be potentially a good test for json ?

    • @theodorealenas3171
      @theodorealenas3171 Před rokem

      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}

    • @CottidaeSEA
      @CottidaeSEA Před rokem

      @@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.

  • @shm236
    @shm236 Před rokem

    This video made me physically ill.
    9/10. Would smash like button again.

  • @ianrichardmcomber8133

    "Ha ha, nerd..."
    *Continues furiously taking notes*

  • @mildlymusical4054
    @mildlymusical4054 Před rokem +1

    Whenever you said "Good job" , my disappointment was immeasurable.

  • @tysonkoch468
    @tysonkoch468 Před rokem

    Most underrated programming channel

  • @hadiwinatakuo1884
    @hadiwinatakuo1884 Před rokem

    JSON: "never let them know your next move"

  • @petrpechkurov3095
    @petrpechkurov3095 Před rokem

    Thank you, Mr. ThePrimeagen!

  • @KangJangkrik
    @KangJangkrik Před rokem +3

    This is why JS has more bugs than C

  • @jameskoonts6512
    @jameskoonts6512 Před 6 měsíci

    😂 that was fun, you should do more videos like this

  • @mrk131324
    @mrk131324 Před rokem +2

    That’s more about the absurdity of JavaScript and it’s JSON module and less about JSON.

  • @mr.gandalfgrey2428
    @mr.gandalfgrey2428 Před rokem +4

    Oddly satisfying how this guy is shooting against everything and everyone (except for Rust). Keep on going! :D

  • @AZisk
    @AZisk Před rokem

    i don’t get it. why is the A missing from this programming language?

  • @CanYouDodgeThis
    @CanYouDodgeThis Před rokem

    This was a fun video format.

  • @juliusmarminge
    @juliusmarminge Před rokem +1

    this was.... interesting and very entertaining

  • @GdeVseSvobodnyeNiki
    @GdeVseSvobodnyeNiki Před 6 měsíci

    This is awesome! Now i know what to ask candidates in an interview for a junior FE position at our company!

  • @angryman9333
    @angryman9333 Před rokem +1

    This makes sense, and is not weird at all but still thanks for the entertainment

  • @codenerd7823
    @codenerd7823 Před rokem

    Title:- you don't know JSON
    The video:- you know nothing, John snow ❄️

  • @7heMech
    @7heMech Před rokem +3

    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...

  • @bhasim4299
    @bhasim4299 Před rokem +12

    Good video and I got 0 correct. :(

    • @ThePrimeagen
      @ThePrimeagen  Před rokem +6

      hahahah

    • @bhasim4299
      @bhasim4299 Před rokem

      @@ThePrimeagen the problem is I mostly do gamedev with canvas api in js so I never have to deal with json

  • @mako3010
    @mako3010 Před rokem

    I'm shooketh

  • @antheus_s
    @antheus_s Před rokem +4

    This was so funny. I work with JSON every day but I got absolutely destroyed. 😅

  • @amateurprogrammer25
    @amateurprogrammer25 Před rokem

    Man, it's like the "Wat" talk all over again. This language is full of surprises

  • @roys2970
    @roys2970 Před rokem

    rocket::serde::json::Json. All the JSON I really need to know.

  • @dskjadiwdjiwaejke
    @dskjadiwdjiwaejke Před rokem

    that was a fun one, thanks!

  • @AnDi-tx2xh
    @AnDi-tx2xh Před rokem +15

    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.

    • @FranzBiscuit
      @FranzBiscuit Před rokem +1

      Personally, I'd rather that it failed on anything other than an object/array literal...

    • @inakiarias7465
      @inakiarias7465 Před rokem +1

      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

    • @FranzBiscuit
      @FranzBiscuit Před rokem +1

      @@inakiarias7465 Oh snap, really? Well now it makes complete sense. Thanks for the clarification!

  • @alangamer50
    @alangamer50 Před rokem +1

    I guess this comes from the fact that JS is completely detached from reality

  • @lazarus6983
    @lazarus6983 Před rokem

    This is like that WAT presentation by destroy All software on JavaScript type conversion conundrums. 10 years later and we're still roasting JavaScript.

  • @aligohar1708
    @aligohar1708 Před rokem

    Bro humbled everyone

  • @susbedoo
    @susbedoo Před rokem

    TOM the genius knows JSON like no other #JDSL

  • @papaquant
    @papaquant Před rokem +2

    Json Statham approves.

    • @ThePrimeagen
      @ThePrimeagen  Před rokem +2

      The transporter

    • @papaquant
      @papaquant Před rokem

      @@ThePrimeagen I was thinking more along the lines of 'snatch', not that it is related but because it's a good movie.

  • @mpelosi1
    @mpelosi1 Před rokem

    This made my day. 😂

  • @scheimong
    @scheimong Před rokem +2

    "JavaScript, 💩, an embarrassing toy language used exclusively to build things it's not supposed to."

  • @fosefx
    @fosefx Před rokem +74

    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)

  • @NathanHedglin
    @NathanHedglin Před rokem +1

    Thankfully I've never seen this in an interview! I failed 😭

  • @magikarpusedsplash8881

    pov: programming gremlin laughs at you as you get a perfect 0% on your job screening

  • @ecranfortessa
    @ecranfortessa Před rokem

    This video proved me that I did not know that JSON even exist.

  • @PsychoKiller250
    @PsychoKiller250 Před rokem

    This video is one of the reason of my chronic insomnia

  • @ghsinfosec
    @ghsinfosec Před rokem

    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!

  • @TyMac711
    @TyMac711 Před rokem +10

    What could be better than javascript? Using javascript logic to transfer your important data!

  • @codenerd7823
    @codenerd7823 Před rokem

    Subtitles:- you don't know JSON
    The video:- you know nothing, John snow ❄️

  • @alexIVMKD
    @alexIVMKD Před rokem

    Man, you're pure comedy

  • @GameSmilexD
    @GameSmilexD Před rokem +2

    "does my ai bot even json?" thats d question

  • @Mincier
    @Mincier Před rokem +1

    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 😂

  • @EdwinGonzalez-pl6ct
    @EdwinGonzalez-pl6ct Před rokem

    I appreciate the title of this video lol

  • @Reinales
    @Reinales Před rokem

    Love you bro😛
    Keep rocking

  • @ascourter
    @ascourter Před rokem

    Love this. More plz

  • @PGDJ88
    @PGDJ88 Před rokem +34

    I got 10 of them very confidently and I feel absolutely filthy for that.

  • @stoneymcwheels1580
    @stoneymcwheels1580 Před rokem

    Just had surgery today. Laughing hurts. Laughed at this video. Love hurts.

  • @hubertjozwiak2422
    @hubertjozwiak2422 Před rokem

    wow i love js even more now

  • @arfelious
    @arfelious Před rokem

    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

  • @irlshrek
    @irlshrek Před rokem

    im having an existential crisis

  • @xoutaku7600
    @xoutaku7600 Před rokem

    it was as entertaining just as much as painful it was

  • @vemarj2802
    @vemarj2802 Před rokem +1

    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.

  • @qbasic16
    @qbasic16 Před 10 měsíci

    JSON Statham is the stronkest! 💪😎

  • @codewithguillaume
    @codewithguillaume Před rokem

    Okay it was entertaining

  • @protocode_227
    @protocode_227 Před rokem

    wp, Jesón.

  • @furl_w
    @furl_w Před rokem

    a spiritual sequel to 'wat'

  • @harshilparmar9076
    @harshilparmar9076 Před rokem

    I like this style of roast the viewer and teach them

  • @awarepenguin3376
    @awarepenguin3376 Před rokem +2

    Interview questions be like...

  • @kenobi6020
    @kenobi6020 Před rokem +30

    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

  • @jishnuviswanath
    @jishnuviswanath Před rokem

    Last one was the Only one I got correctly with confidence

  • @yajirushik2871
    @yajirushik2871 Před rokem

    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.

  • @ColladoG
    @ColladoG Před rokem

    This video caused me physical pain

  • @mirkosedda3196
    @mirkosedda3196 Před rokem +7

    Js is a dumpster fire 🔥🔥🔥

  • @Blaineworld
    @Blaineworld Před rokem

    i am internally screaming

  • @tejashp98
    @tejashp98 Před rokem

    I just know one day, maybe years from now, one of these nice lil quirks is going to ruin my day.

  • @overlordprincekhan
    @overlordprincekhan Před rokem

    Lols, jokes on you for giving easy test questions

  • @Terandium
    @Terandium Před rokem +41

    More arguments about JS being horrible than it being about json

    • @dgcp354
      @dgcp354 Před rokem

      thats always his point

    • @Terandium
      @Terandium Před rokem

      @@dgcp354 ah okay haha didnt know that