Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

The JSON version of flair currently offers these fields:

  • id: The user's ID
  • gravatarHtml: HTML of an IMG tag to display the Gravatar
  • profileUrl: The URL to the user's public profile
  • displayName: The user's display name
  • reputation: The user's rep, with commas separating thousands
  • badgeHtml: HTML to render the entire flair

This is insufficient for a user to build flair to their own liking without doing some html scraping. I'd like the following JSON attributes to be added:

  • gravatarURL: The URL of the Gravatar image, without the size parameters. Or possibly just a gravatarHash field. (Currently, you could get this by scraping the gravatarHtml field, but that's not ideal.)
  • goldBadges: The number of gold badges earned
  • silverBadges: The number of silver badges earned
  • bronzeBadges: The number of bronze badges earned

Also, I'd like reputation to be given as a pure integer. Maybe a user wants to show off their badge on a German site, where "." is used as the thousands separator. Or maybe they would prefer to show their rep in hex. (Yes, I know I could strip the comma from the reputation field, but I'd prefer it if the comma didn't come there to begin with.)

share|improve this question
up vote 6 down vote accepted

I was working today on an image based flair for use in forums:

For Light backgrounds

StackOverflow      ServerFault      SuperUser

For Dark backgrounds

StackOverflow      ServerFault      SuperUser

I had to do some HTML scraping on gravatarHtml and badgeHtml in order to get badges and gravatar URL, and I didn't bother changing the number format.

The JSON flair format should give us access to the data, not force its implementers to use the flair HTML and number formatting. I agree with the original poster that flair.json should have the following modifications:

  • Addition of goldBadges, silverBadges, bronzeBadges or even better, implement it as:

    'badges': {'bronze': 1, 'silver': 2, 'gold': 3}

  • Pure integer value for reputation and badge values

  • gravatarURL without the s parameter to the url

Note: You can download the source.

share|improve this answer
good ideas, thanks – Kip Jul 24 '09 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .