• (nodebb)
    ::COMMENT:{<frist>};;
    

    Or something like that.

    Addendum 2024-05-29 07:13: I couldn't be bothered to figure out what the format actually is.

  • (nodebb)

    It looks like major objects are serialized as the key, a colon, then curly braced key-value pairs. Each major object is separated by two colons, presumably so they can deserialize by splitting on '::'. Each key-value pair is serialized as key="value" and separated by two semicolons — again, I'd assume, so they can deserialize with a naive split on ';;'.

    document:
      (object '::')* object
    object:
      <name> ':{' object-values '}'
    object-values:
      (kvp ';;')* kvp
    kvp:
      <key> '="' <value> '"'
    

    Addendum 2024-05-29 07:22: Eh. I missed the angle bracket version at the bottom. It looks like tplTable (i.e. "TPL") is serialized as "special" key-value pairs, but *only if there's two or more rows???

  • Sauron (unregistered)

    Let's face it, JS is TRWTF anyway.

    JS is less a programming language than it is a torture tool.

  • Pabz (unregistered)

    I think you're right Remy - we don't need to punish Michael for writing this. However, Michael was assigned a task to write some code in a language that he was unfamiliar with when it was already past the deadline. I'd be very interested to know how that situation came about...

  • (nodebb)

    Michael doesn't need JSON because he invented WTFSON.

  • Sauron (unregistered) in reply to jeremypnet

    I think it's be:

    COMMENT:{frist="frist"}
    

    and if with 2 fields in COMMENT, it'd be:

    COMMENT:{frist="frist";;secnod="secnod"}
    

    whereas with 2 COMMENTs instead, it'd be:

    And of course, you could have the case of more than 1 comment AND more than 1 field:

    COMMENT1:{frist="frist";;secnod="secnod"}::COMMENT2:{thrid="thrid"}
    
  • (nodebb) in reply to Pabz

    However, Michael was assigned a task to write some code in a language that he was unfamiliar with when it was already past the deadline. I'd be very interested to know how that situation came about...

    Simple: Michael got into software development.

  • dusoft (unregistered) in reply to adamantoise

    Indeed, WTFSON it is.

  • (nodebb)

    At least the data is escaped, which is already a step up over a lot of existing code.

  • Roby McAndrew (unregistered) in reply to Medinoc

    This code definitely escaped, rather than being released.

  • (nodebb)

    He that is without sin among us, let him first (frist?) cast a stone at Michael...

  • Officer Johnny Holzkopf (unregistered)

    The 'null="null"' has potential for submitting more useful information in a serially serialized serial way, like one="one", two="2", three="3.00", four="FILE_NOT_FOUND", five="four lights", true="FALSE" and brillant="paula", and so on...

  • Álvaro González (github)

    A save function with no arguments always announces something good. The _variable _naming _schema is a lovely touch.

  • Duke of New York (unregistered)

    It was short notice, he didn't know the language, yada yada… and the underscores?

  • (nodebb) in reply to Álvaro González

    Naming JS variables with an underscore at the start is meant to signify that they are private and should be treated as such. Of course, as with typing, JS works on the honour system, and enforces absolutely nothing.

  • MaxiTB (unregistered)

    How many decades are JSON.stringify and JSON.parse around?

  • Vera (unregistered) in reply to MaxiTB

    Regardless; The backstory suggests that Michael was put under a lot of pressure. Never a good thing when you're trying to learn a system you never used before.

Leave a comment on “A Serial Offender”

Log In or post as a guest

Replying to comment #:

« Return to Article