title: Blogger home URL retrieved via json
body: <p><em>Disclaimer: I have no knowledge of programming.<br>
  I'm just doing my best to catch up with as much as possible.</em></p>
  
  <p>While reading (and later on trying out) the answer to <a href="https://stackoverflow.com/questions/24924652/using-relative-links-in-blogger">this question</a>, I was thinking that a possibly nice &amp; useful update would be to have the same kind of info in json terms, i.e. how do I retrieve the "home" URL of a Blogger blog by means of json.</p>
  
  <p>I tried to figure it out on my own, since I know, for example, that...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function specialpost(json) {
   document.write('&lt;div&gt;');
  // VARIABLE DECLARATION
   var i;
   var j;
  // LOOP
   for (i = 0; i &lt; json.feed.entry.length; i++)
   {
    for (j = 0; j &lt; json.feed.entry[i].link.length; j++) {
     if (json.feed.entry[i].link[j].rel == 'alternate') {
      break;
     }
    }
  var postUrl = "'" + json.feed.entry[i].link[j].href + "'";
  var postTitle = json.feed.entry[i].title.$t;
  var postContent = json.feed.entry[i].content.$t;
  var item = '&lt;h3&gt;&lt;a href="' + postUrl + '" target="_blank"&gt;' + postTitle + '&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;' + postContent + '&lt;/p&gt;';
   document.write(item);
   }
   document.write('&lt;/div&gt;');
   }
  &lt;/script&gt;
  &lt;script src="https://MYBLOG.blogspot.com/feeds/posts/default/-/special?max-results=NUMBER_OF_POSTS_DISPLAYED&amp;alt=json-in-script&amp;callback=specialpost"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>...will give me a <code>div</code>, containing title (incl. link) and content of a desired number of posts labeled "special", but I got a bit confused halfway through my attempt.</p>
  
  <p>I'm using <a href="http://jsonviewer.stack.hu/" rel="nofollow noreferrer">jsonviewer</a> to view my blog's json code in comprehensible tree-like form, and I'm guessing that if the URL to each post is stored somewhere inside <code>[] entry</code>, then the URL to the blog itself is probably stored somewhere inside <code>[] link</code>.</p>
  
  <p><strong>Question</strong>: Am I right?</p>
  
  <p><code>[] link</code> contains 4 entries: <code>{}0</code>  <code>{}1</code>  <code>{}2</code> and <code>{}3</code><br>
  each one of them, in turn, containing 3 entries:</p>
  
  <ul>
  <li><p><code>rel</code> set to <code>"http://schemas.google.com/g/2005#feed"</code>  <code>"self"</code>  <code>"alternate"</code> and <code>"hub"</code> respectively</p></li>
  <li><p><code>type</code> set to <code>"application/atom+xml"</code> for the first two and <code>text/html</code> for the third one<br>- not defined for <code>{}3</code></p></li>
  <li><p><code>href</code> set to<br><br>
  <code>"http://MYBLOG.blogspot.com/feeds/posts/default"</code><br><br>
  (<em>which followed by</em> <code>?alt=json</code> <em>gives us the URL to the very same json code<br>
  I entered into</em> <a href="http://jsonviewer.stack.hu/" rel="nofollow noreferrer">jsonviewer</a> <em>in order to get the tree-like view</em>)<br><br>
  <code>"https://www.blogger.com/feed/1234567890123456789/posts/default?alt=json"</code><br><br>
  (<em>that 19-digit number being, I suppose, some machine-wise generated numeric name<br>
  that Google has assigned to my blog</em>)<br><br>
  <code>"http://MYBLOG.blogspot.com"</code> and<br><br>
  <code>"http://pubsubhubbub.appspot.com"</code>  respectively.</p></li>
  </ul>
  
  <p>I guess what I'm after is <code>{}2</code></p>
  
  <p><strong>Question</strong>: Am I right again? If so, how can I declare that the value of, say, <code>var myblogUrl</code> is set to the <code>href</code> stored inside that <code>{}2</code> entry?</p>
  
  <p><strong>Last, but not least</strong>: What are the other three entries for? The <code>href</code> stored in entry <code>{}0</code> resembles the one taking you to a kind of subscription page where you can choose by what means you would like to subscribe to the blog in question. Is this really the case? </p>