A small tool to view real-world ActivityPub objects as JSON! Enter a URL
or username from Mastodon or a similar service below, and we'll send a
request with
the right
Accept
header
to the server to view the underlying object.
{
"@context": [
"https://join-lemmy.org/context.json",
"https://www.w3.org/ns/activitystreams"
],
"type": "Page",
"id": "https://programming.dev/post/26056160",
"attributedTo": "https://programming.dev/u/sus",
"to": [
"https://programming.dev/c/python",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": "Find the bug (a classic)",
"cc": [],
"content": "<pre style=\"background-color:#ffffff;\">\n<span style=\"color:#323232;\">class Node:\n</span><span style=\"color:#323232;\"> def __init__(self, edges = set()):\n</span><span style=\"color:#323232;\"> self.edges = edges\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\">def main():\n</span><span style=\"color:#323232;\"> foo = Node()\n</span><span style=\"color:#323232;\"> bar = Node()\n</span><span style=\"color:#323232;\"> quz = Node()\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\"> foo.edges.add(bar)\n</span><span style=\"color:#323232;\"> bar.edges.add(foo)\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\"> assert(foo is not bar) # assertion succeeds\n</span><span style=\"color:#323232;\"> assert(foo is not quz) # assertion succeeds\n</span><span style=\"color:#323232;\"> assert(bar is not quz) # assertion succeeds\n</span><span style=\"color:#323232;\"> assert(len(quz.edges) == 0) # assertion fails??\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\">\n</span><span style=\"color:#323232;\">main()\n</span></pre>\n<details><summary>spoiler</summary><p>Mutable default values are shared across objects. The set in this case.\n</p></details>\n",
"mediaType": "text/html",
"source": {
"content": "```\nclass Node:\n def __init__(self, edges = set()):\n self.edges = edges\n\n\ndef main():\n foo = Node()\n bar = Node()\n quz = Node()\n\n foo.edges.add(bar)\n bar.edges.add(foo)\n\n assert(foo is not bar) # assertion succeeds\n assert(foo is not quz) # assertion succeeds\n assert(bar is not quz) # assertion succeeds\n assert(len(quz.edges) == 0) # assertion fails??\n\n\nmain()\n```\n\n::: spoiler spoiler\nMutable default values are shared across objects. The set in this case.\n:::\n",
"mediaType": "text/markdown"
},
"attachment": [],
"sensitive": false,
"published": "2025-02-26T17:34:23.362272Z",
"audience": "https://programming.dev/c/python",
"tag": [
{
"href": "https://programming.dev/post/26056160",
"name": "#python",
"type": "Hashtag"
}
]
}