Why not embed JSON data inside the user profile?

Hi All

I’ve been playing around with AP lately and I have a simple proposal:

Why not embed JSON data inside the profile page?

Currently in order to get a machine readable profile, there are a number of steps and moving parts. You go from a user to a user id in a specific way. You then do the webfinger dance and then get some json data back. You then follow that JSON data and get a machine readable JSON profile.

There’s lots of historical reasons for these choices, but what if there was a simpler way?

What if you could just embed the JSON inside your profile using a SCRIPT tag?

This pattern is being deployed now on millions of websites and is growing fast. It’s typically done for SEO but there’s no reason at all why it shouldnt be extended beyond that. Here’s a few links explaining how the so-called “data island” pattern works



The advantage of doing so would be that AP profiles could interact with more systems. For example it would then be much easier for AP and Solid to interact, share apps, share developers etc.

Curious if anyone has had any thoughts along these lines. I would be tempted to try and patch a server to include this simplification.


You don’t need to go through webfinger, the user uri usually responds fine to json request. Try out curl -H "Accept: application/ld+json" https://mastodon.social/@gargron


That’s really nice, thanks!

One entry that comes back is:

“id”: “https://mastodon.social/users/Gargron”,

The id of the thing that you ran curl on and the id that shows up are slightly different modulo a @sign


“url”: “https://mastodon.social/@Gargron”,

Is consistent

Having consistent URIs really helps when you get to federation

When you do

curl -L https://mastodon.social/gargron

Without the “@” then it gives an error

However, on the whole this is really quite epic

What could be done in some networks to simplify the whole process is to put the json-ld that you get back in a script tag in the profile url (ie html) this is the so-called structured data island pattern

I also just noticed this:

 <script id="initial-state" type="application/json">{"meta":

Seems mastodon is further advanced than I thought!

That’s excellent and now you just need to put the JSON-LD in there (which is something it was designed for) and it’s ready to go!

1 Like