I think if there's one thing I'd say to # ActivityPub developers, it's this: it seems like it's going to be easier to just parse Activity Streams 2
I think if there's one thing I'd say to #ActivityPub developers, it's this: it seems like it's going to be easier to just parse Activity Streams 2.0 data as plain JSON, but it's not. You have to keep track of too many variations. Use a JSON-LD library instead. For JavaScript, try activitystrea.ms:
Human Web Collective
@evan i would add that there are several other more actively maintained options, at least: json-ld.org/#developers
in the most basic case, expanding the document should make it unambiguous:
- all keys are normalized to full identifiers with exactly 1 possible representation instead of infinitely many
- all values are normalized to JSON
arrays of JSON objects
- those JSON objects explicitly say whether they have an id (Reference) or a value (Literal)
@trwnh "more actively maintained"?
The code is long-term but it was built by one author of AS2 and maintained by the other. It works well, and I use it in production systems all the time.
I'm pretty sure @hongminhee has made a similar package, although I'm not sure it's distributed independently.
@evan@cosocial.ca @trwnh@mastodon.social Iβm maintaining the
@fedify/vocabpackage which depends on thejsonldpackage from Digital Bazaar. Itβs written in 100% TypeScript, and has worked well on production services!