JSON and Microformats
- by Tauren
I'm looking for opinions on whether microformats should be used to name JSON elements. For instance, there is a microformat for physical addresses, that looks like this:
<div class="adr">
<div class="street-address">665 3rd St.</div>
<div class="extended-address">Suite 207</div>
<span class="locality">San Francisco</span>,
<span class="region">CA</span>
<span class="postal-code">94107</span>
<div class="country-name">U.S.A.</div>
</div>
There is a document available on using JSON and Microformats. The information above could be represented as JSON data like this:
"adr": {
"street-address":"665 3rd St.",
"extended-address":"Suite 207",
"locality":"San Fransicso",
"region":"CA",
"postal-code":"94107",
"country-name":"U.S.A."
},
The issue I have with this is that I'd like my JSON data to be as lightweight as possible, but still human readable. While still supporting international addresses, I would prefer something like this:
"address": {
"street":"665 3rd St.",
"extended":"Suite 207",
"locality":"San Fransicso",
"region":"CA",
"code":"94107",
"country":"U.S.A."
},
If I'm designing a new JSON API right now, does it make sense to use microformats from the start? Or should I not really worry about it? Is there some other standard that is more specific to JSON that I should look at?