REST, Hypermedia, and JSON

Enjoying Sam Ruby's latest post titled Connecting, I was reminded that designing a RESTful system means much more than just adhering to a uniform interface (often the first attribute of a ROA that is promoted).

When designing a Resource Oriented Architecture, you mustn't forget about hypermedia and how your resources link to one another, and how those links are expressed through your representations.

Which brings me to JSON. A nifty little format, indeed. And one that, if you are building a modern web service, you should be investigating and implementing. However, if you are indeed building a hypermedia system with JSON, how do you express your links?

I know how to do this in XHTML and RDF, but not sure how to express or render a URI and have it mean "link".

I've love to be able to do something like this:


{
"name": "Cool Beans",
"account": "http://example.org/accounts/23242342"
}


However, any JSON client will have a tough time determining what the meaning of the account value is. Sure, it's a string. But how should it be treated? And how do I express that to my JSON clients? I'm not about to give them a regular expression and say "if it matches, it's a URI, and follow it!"

Thoughts? How to express hypermedia in JSON?

Popular posts from this blog

Lists and arrays in Dart

The 29 Healthiest Foods on the Planet

Converting Array to List in Scala