Skip to content

Hashtags and JSON-LD

The examples here are various variations of creating the Hashtag element in the tag list. These variations can be useful in understanding how strict an application sees JSON-LD.

Hashtags are a good illustration of JSON-LD parsing as Hashtag is not part of the ActivityStreams vocabulary.

All examples except the first are questionable, and probably should not be used when publishing to the Fediverse. The examples marked with ⚠️ are expected to fail with a JSON-LD parser. The examples using as:Hashtag are expected to fail with a JSON only parser.

Examples

Example 1

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://pyfedi.local/c/pie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/activity/1PdDXEIeSLI",
  "published": "2025-09-08T17:26:57Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://pyfedi.local/c/pie"
    ],
    "id": "http://pasture-one-actor/object/kzdvPBscHws",
    "published": "2025-09-08T17:26:57Z",
    "content": "text",
    "tag": [
      {
        "type": "Hashtag",
        "name": "#test"
      },
      {
        "type": "Mention",
        "href": "http://pyfedi.local/c/pie"
      }
    ]
  }
}
pyfedi
{
  "id": 14,
  "user_id": 2,
  "community_id": 1,
  "title": "(content in post body)",
  "deleted": false,
  "nsfw": false,
  "sticky": false,
  "published": "2025-09-08T17:26:58.026196Z",
  "ap_id": "http://pasture-one-actor/object/kzdvPBscHws",
  "local": false,
  "language_id": 2,
  "removed": false,
  "locked": false,
  "body": "text"
}

Example 2

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://pyfedi.local/c/pie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/activity/qsJmvBeNKeM",
  "published": "2025-09-08T17:26:58Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://pyfedi.local/c/pie"
    ],
    "id": "http://pasture-one-actor/object/TdVCA6G6YPw",
    "published": "2025-09-08T17:26:58Z",
    "content": "using as:Hashtag",
    "tag": [
      {
        "type": "as:Hashtag",
        "name": "#test"
      },
      {
        "type": "Mention",
        "href": "http://pyfedi.local/c/pie"
      }
    ]
  }
}
pyfedi
{
  "id": 15,
  "user_id": 2,
  "community_id": 1,
  "title": "[Microblog] using as:Hashtag",
  "deleted": false,
  "nsfw": false,
  "sticky": false,
  "published": "2025-09-08T17:26:58.830374Z",
  "ap_id": "http://pasture-one-actor/object/TdVCA6G6YPw",
  "local": false,
  "language_id": 2,
  "removed": false,
  "locked": false,
  "body": "using as:Hashtag"
}

Example 3

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://pyfedi.local/c/pie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/activity/D91BWTq0zPw",
  "published": "2025-09-08T17:26:59Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://pyfedi.local/c/pie"
    ],
    "id": "http://pasture-one-actor/object/qFiBXBf8nBQ",
    "published": "2025-09-08T17:26:59Z",
    "content": "no type \u26a0\ufe0f ",
    "tag": [
      {
        "name": "#test"
      },
      {
        "type": "Mention",
        "href": "http://pyfedi.local/c/pie"
      }
    ]
  }
}

no result

Example 4

activity
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://pyfedi.local/c/pie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/activity/kCqoD0XVxm0",
  "published": "2025-09-08T17:27:11Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://pyfedi.local/c/pie"
    ],
    "id": "http://pasture-one-actor/object/jMEU-4fFjPk",
    "published": "2025-09-08T17:27:11Z",
    "@context": "https://www.w3.org/ns/activitystreams",
    "content": "Hashtag not in @context \u26a0\ufe0f ",
    "tag": [
      {
        "type": "Hashtag",
        "name": "#test"
      },
      {
        "type": "Mention",
        "href": "http://pyfedi.local/c/pie"
      }
    ]
  }
}
pyfedi
{
  "id": 16,
  "user_id": 2,
  "community_id": 1,
  "title": "Hashtag not in @context \u26a0\ufe0f",
  "deleted": false,
  "nsfw": false,
  "sticky": false,
  "published": "2025-09-08T17:27:11.721392Z",
  "ap_id": "http://pasture-one-actor/object/jMEU-4fFjPk",
  "local": false,
  "language_id": 2,
  "removed": false,
  "locked": false,
  "body": "Hashtag not in @context \u26a0\ufe0f "
}

Example 5

activity
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://pyfedi.local/c/pie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/activity/NdcMP7-CIyQ",
  "published": "2025-09-08T17:27:12Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://pyfedi.local/c/pie"
    ],
    "id": "http://pasture-one-actor/object/PBZukblTFKE",
    "published": "2025-09-08T17:27:12Z",
    "@context": "https://www.w3.org/ns/activitystreams",
    "content": "Hashtag not in @context; as:Hashtag",
    "tag": [
      {
        "type": "as:Hashtag",
        "name": "#test"
      },
      {
        "type": "Mention",
        "href": "http://pyfedi.local/c/pie"
      }
    ]
  }
}
pyfedi
{
  "id": 17,
  "user_id": 2,
  "community_id": 1,
  "title": "Hashtag not in @context; as:Hashtag",
  "deleted": false,
  "nsfw": false,
  "sticky": false,
  "published": "2025-09-08T17:27:12.467221Z",
  "ap_id": "http://pasture-one-actor/object/PBZukblTFKE",
  "local": false,
  "language_id": 2,
  "removed": false,
  "locked": false,
  "body": "Hashtag not in @context; as:Hashtag"
}