JSON, I hardly know 'er

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 570

  • @tesla1772
    @tesla1772 Год назад +1917

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

    • @darkfoxwillie
      @darkfoxwillie Год назад +26

      this hits so much jajajaja

    • @austinedeclan10
      @austinedeclan10 Год назад +12

      JS is like the meaning of life. We'll never fully know

  • @FlorianWendelborn
    @FlorianWendelborn Год назад +934

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

    • @dejangegic
      @dejangegic Год назад +83

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

    • @BurgerKingHarkinian
      @BurgerKingHarkinian Год назад +6

      That's what I was thinking as well

    • @cerulity32k
      @cerulity32k Год назад +2

      hjson my beloved

    • @fenkraken
      @fenkraken Год назад +27

      @@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 Год назад +74

      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 Год назад +234

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

    • @CottidaeSEA
      @CottidaeSEA Год назад +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 Год назад +2

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

    • @rajesh_404
      @rajesh_404 Год назад +1

      🤣🤣🤣

    • @SemiMono
      @SemiMono 11 месяцев назад +3

      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 Год назад +415

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +113

      that is... maybe a good argument

    • @barry4207
      @barry4207 Год назад +43

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

    • @andre_julius
      @andre_julius Год назад +46

      James "Json" Jansoon

    • @babudelhi9885
      @babudelhi9885 Год назад +5

      @@andre_julius that explains alot

    • @CottidaeSEA
      @CottidaeSEA Год назад +13

      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 Год назад +112

    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 Год назад

      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 Год назад +1

      ​@@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 Год назад +269

    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 Год назад +22

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

    • @heavenstone3503
      @heavenstone3503 Год назад

      @@Bozon671_Higgs A Class is an object therefore nobody cares

    • @savagesarethebest7251
      @savagesarethebest7251 Год назад +4

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

  • @scheimong
    @scheimong Год назад +9

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +2

      Fireship quote
      a man of culture i see

  • @ThePrimeagen
    @ThePrimeagen  Год назад +13

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

  • @alexodan
    @alexodan Год назад +53

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

  • @steveyoo9342
    @steveyoo9342 Год назад +7

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

  • @mrk131324
    @mrk131324 Год назад +4

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

  • @coolworx
    @coolworx Год назад +7

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

  • @thecodeburger
    @thecodeburger Год назад +3

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад

      who knows whats even happening in there

  • @4.0.4
    @4.0.4 Год назад +3

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

  • @CottidaeSEA
    @CottidaeSEA Год назад +8

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

  • @EricBishard
    @EricBishard Год назад +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 Год назад +3

      Then what can be potentially a good test for json ?

    • @theodorealenas3171
      @theodorealenas3171 Год назад

      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 Год назад

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

  • @beriu3512
    @beriu3512 Год назад +2

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад

      best part is, that private in ts doesnt :)

    • @beriu3512
      @beriu3512 Год назад

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

  • @Y0y0Jester
    @Y0y0Jester Год назад +2

    2:52 RUclips hand-picked the exact video that I watched two minutes ago and that led me to watch this video. Are they dumb or do they want me to enter an infinite loop?

  • @kuo1337
    @kuo1337 Год назад +1

    JSON: "never let them know your next move"

  • @IgorGuerrero
    @IgorGuerrero Год назад +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 Год назад +3

      This is something I want to know as well

    • @yuri0001
      @yuri0001 Год назад +1

      I think it's both.

    • @georgeokello8620
      @georgeokello8620 Год назад

      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 Год назад +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

  • @HansLemurson
    @HansLemurson Год назад +1

    My morale is now undefined.

  • @7heMech
    @7heMech Год назад +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...

  • @ianrichardmcomber8133
    @ianrichardmcomber8133 Год назад

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

  • @awarepenguin3376
    @awarepenguin3376 Год назад +2

    Interview questions be like...

  • @lazarus6983
    @lazarus6983 Год назад

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

  • @fosefx
    @fosefx Год назад +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)

  • @KangJangkrik
    @KangJangkrik Год назад +3

    This is why JS has more bugs than C

  • @Ma1ne2
    @Ma1ne2 Год назад +6

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +3

      it just might be

    • @Ma1ne2
      @Ma1ne2 Год назад

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

  • @its_finn96
    @its_finn96 Год назад +3

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

  • @tanishqsingla9492
    @tanishqsingla9492 Год назад +18

    I hate this game that we're playing

    • @ThePrimeagen
      @ThePrimeagen  Год назад +8

      makes me feel things i shouldn't feel

  • @alangamer50
    @alangamer50 Год назад +1

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

  • @ecranfortessa
    @ecranfortessa Год назад

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

  • @codenerd7823
    @codenerd7823 Год назад

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

  • @PGDJ88
    @PGDJ88 Год назад +35

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +26

      you filthy filthy internet person

  • @ambuj.k
    @ambuj.k Год назад

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

  • @grumpylibrarian
    @grumpylibrarian Год назад +1

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

  • @papaquant
    @papaquant Год назад +2

    Json Statham approves.

    • @ThePrimeagen
      @ThePrimeagen  Год назад +2

      The transporter

    • @papaquant
      @papaquant Год назад

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

  • @mr.gandalfgrey2428
    @mr.gandalfgrey2428 Год назад +4

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

  • @mharbol
    @mharbol Год назад +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.

  • @amateurprogrammer25
    @amateurprogrammer25 Год назад

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

  • @marcelofernandez6561
    @marcelofernandez6561 Год назад +1

    love this format, thx!

  • @codenerd7823
    @codenerd7823 Год назад

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

  • @danielschmider5069
    @danielschmider5069 Год назад

    The swamp seeps into the shed built on top of it

  • @objectobject255
    @objectobject255 Год назад

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

  • @Terandium
    @Terandium Год назад +41

    More arguments about JS being horrible than it being about json

    • @dgcp354
      @dgcp354 Год назад

      thats always his point

    • @Terandium
      @Terandium Год назад

      @@dgcp354 ah okay haha didnt know that

  • @uMadBrudi
    @uMadBrudi Год назад +3

    I knew this video was going to be cursed once he started to pronounce "JSON" as "jayson" instead of "jawwwwsaawww"

  • @magikarpusedsplash8881
    @magikarpusedsplash8881 Год назад

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

  • @kkumar2618
    @kkumar2618 Год назад

    It started with “Hey I know JSON” and the sometime while on the midst of this video, don’t came between i and know 😢

  • @hszt4414
    @hszt4414 Год назад

    one of the best pieces of content on the internet

  • @GameSmilexD
    @GameSmilexD Год назад +2

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

  • @AnDi-tx2xh
    @AnDi-tx2xh Год назад +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 Год назад +1

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

    • @inakiarias7465
      @inakiarias7465 Год назад +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 Год назад +1

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

  • @hansdampf2284
    @hansdampf2284 Год назад

    Judging by the amount of time I waste trying to hunt down a missing comma or even a comma too much I knew before watching that I don’t know shit about json

  • @roys2970
    @roys2970 Год назад

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

  • @andre_julius
    @andre_julius Год назад +3

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA whyyy JSON, WHYYYYYYYYYYYYYYy

  • @GdeVseSvobodnyeNiki
    @GdeVseSvobodnyeNiki Год назад

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

  • @VitalijMik
    @VitalijMik Год назад +2

    now lets pick JSON and put into our MYSQL Database so we have everywhere json :D

    • @ThePrimeagen
      @ThePrimeagen  Год назад +2

      i love this idea
      and that is how mongo was born

    • @VitalijMik
      @VitalijMik Год назад

      @@ThePrimeagen well i have to use mysql with JSON fields where i have to convert JSON from mysql via PHP to JavaScript :D

  • @kenobi6020
    @kenobi6020 Год назад +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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +9

      i am thinking about some fun things :)

    • @kenobi6020
      @kenobi6020 Год назад +3

      @@ThePrimeagen FOLKEEEEEEEEE

  • @mildlymusical4054
    @mildlymusical4054 Год назад +1

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

  • @jsalsman
    @jsalsman Год назад +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.

  • @petrpechkurov3095
    @petrpechkurov3095 Год назад

    Thank you, Mr. ThePrimeagen!

  • @ContraHacker1337
    @ContraHacker1337 Год назад +4

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

    • @ThePrimeagen
      @ThePrimeagen  Год назад +1

      yeah jason, you need to make up for your actions

  • @tysonkoch468
    @tysonkoch468 Год назад

    Most underrated programming channel

  • @irlshrek
    @irlshrek Год назад

    im having an existential crisis

  • @jonathan-._.-
    @jonathan-._.- Год назад

    but did you know :
    you can create an object and give it the toJSON method and it will take whatever returns from the method as its representation

  • @Admir5595
    @Admir5595 2 месяца назад

    Software development in 2024: watch other devs coding while copilot is responding

  • @gideonmaxmerling204
    @gideonmaxmerling204 Год назад

    1:25 this is not because of json, this is due to how json parsing works in javascript.
    javascript uses floating point numbers, and when you get to really big numbers you get a precision error because you can't represent them.
    the json specs say that implementations may do this since, well, they kinda have to, but in theory this is an implementation issue and not a json quirk.
    also, stringifying any value that is not in the json spec doesn't really test json knowledge, it tests js knowledge.

  • @SzaboB33
    @SzaboB33 Год назад

    I entered this challenge way too confidently.

  • @susbedoo
    @susbedoo Год назад

    TOM the genius knows JSON like no other #JDSL

  • @tivrusky3483
    @tivrusky3483 11 месяцев назад

    damn i've been completely topped by a random dude with a moustache when it comes to json... what a humiliation...

  • @tejashp98
    @tejashp98 Год назад

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

  • @AZisk
    @AZisk Год назад

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

  • @TyMac711
    @TyMac711 Год назад +10

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

  • @juliusmarminge
    @juliusmarminge Год назад +1

    this was.... interesting and very entertaining

  • @replikvltyoutube3727
    @replikvltyoutube3727 Год назад +1

    Hmm that makes me think, can't functions be serialized as WebAssembly bytecode in JSON.

  • @nikfp
    @nikfp Год назад

    I feel personally attacked because I don't want to admit my own lack of knowledge

  • @angryman9333
    @angryman9333 Год назад +1

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

  • @antheus_s
    @antheus_s Год назад +4

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

  • @stoneymcwheels1580
    @stoneymcwheels1580 Год назад

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

  • @dmitry.shpakov
    @dmitry.shpakov Год назад

    OMG, It's JSON Bourne!

  • @tvanantwerp
    @tvanantwerp Год назад

    The new "wat" just dropped.

  • @NathanHedglin
    @NathanHedglin Год назад +1

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

  • @darwinapolinario5605
    @darwinapolinario5605 Год назад +1

    Null is technically an object

  • @animanaut
    @animanaut Год назад +2

    to quote "programmers are also human" video about javascript: "did you know javascript was actually written in 7 days ... such a messy language ... i love it". Reference: ruclips.net/video/Uo3cL4nrGOk/видео.html

  • @shm236
    @shm236 Год назад

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

  • @manomyth11
    @manomyth11 Год назад

    You know why Dr Pepper comes in a can'

  • @mohitkumar-jv2bx
    @mohitkumar-jv2bx Год назад +1

    Man that was demotivating 😂😂

  • @furl_w
    @furl_w Год назад

    a spiritual sequel to 'wat'

  • @magno5157
    @magno5157 Год назад +1

    Look, that stringify method isn't a part of the JSON specs. The specs only define the grammar, i.e. what the parsing should obey, and nothing more. So, there's no specs for how to stringify NaN and Infinity or, in fact, anything, really. That said, it makes sense to map NaN and Infinity to "null" (even though it's wrongly printed as 'null', because a JSON string cannot be enclosed with a pair of single quotes).

  • @ringletingle
    @ringletingle Год назад

    Json? Barely even know er !

  • @codewithguillaume
    @codewithguillaume Год назад

    Okay it was entertaining

  • @romanext921
    @romanext921 Год назад +1

    Javascript is indeed super wacky. I just stick to only using objects and arrays with JSON things

  • @shinuza
    @shinuza Год назад

    The first one is easy, if you follow the specification a json string is contained between double quotes.

  • @teej_dv
    @teej_dv Год назад

    we don't talk about json no no no no

  • @despareint
    @despareint Год назад

    you shattered my confidence with JSON lol

  • @xijinping5064
    @xijinping5064 Год назад

    I feel attacked by this video

  • @thehibbi
    @thehibbi Год назад +1

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

  • @qbasic16
    @qbasic16 Год назад

    JSON Statham is the stronkest! 💪😎

  • @jameskoonts6512
    @jameskoonts6512 Год назад

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

  • @aryanmn1569
    @aryanmn1569 Год назад

    I implemented json syntax some days ago and I didn't see some of them coming

  • @coderstubechannel
    @coderstubechannel Год назад +1

    Simply enlightening for me and my channel! 💪