Elektrine lite

← Feed

@mczachurski@mastodon.social

2026-03-19 16:51 UTC

Spent the whole day fixing ActivityPub JSON deserialization for different servers. You start with: "this field is probably a string" and end with: "this field is apparently a string, an object, an array, an array of objects, or an eldritch combination of all four." Turns out JSON is less a format and more a negotiation. Now I'm just curious what systems I haven't met yet are storing in "url". Maybe a dictionary with keys like href, vibes, and trust_me_bro..

Replies (5)

  • @halcy@icosahedron.website 2026-03-26 11:21

    @mczachurski on the internet, you never know who could be an ISO 8601 datetime.

    Open ##1637113

  • @mczachurski json is a format. the json parser has no trouble reading it. it's the protocols on top which are often more of a negotiation.

    Open ##1637114

  • @EndlessMason@hachyderm.io 2026-03-26 11:25

    @mczachurski Which parser accepts that last one? "url": [ "href": "http...", {} ] that second : seems like it would trip up every parser I've ever seen. I don't even think yaml would be ok with that kind of nonsense

    Open ##1637118

  • @julian@fietkau.social 2026-03-26 11:32

    @mczachurski @liaizon That's all expected JSON-LD stuff, I believe. JSON-LD parsers are required to treat a single value as equivalent to an array of length 1 containing the same value, and I think basically any property containing a single value can in theory contain a list of values. In the same vein, parsers are supposed to treat bare object IDs the same as inlined forms of the objects. I've never looked into whether the same goes for links, but it doesn't surprise me if it does.

    Open ##1637120

  • @dch@bsd.network 2026-03-26 11:46

    @mczachurski these are real examples from real servers? They have played us for absolute fools.

    Open ##1637122