/    Sign up×
Community /Pin to ProfileBookmark

JSON Array access question

Hello,

I’m trying to use the JSON functionality within del.icio.us, which can tell us, for a given URL, which tags are associated to that URL and the counts for each tag. (For example, for [url]http://www.nytimes.com/[/url], it might be associated with the tag “newspaper” 400 times, “nyc” 250 times, “news” 500 times, etc.)

That functionality is described well on this page: [url]http://del.icio.us/help/json/url[/url].

For example, this JSON call (for [url]http://del.icio.us/):[/url]
[url]http://badges.del.icio.us/feeds/json/url/data?hash=46efc577b7ddef30d1c6fd13311b371e[/url]

Gives a JSON output like this:
[{“hash”:”46efc577b7ddef30d1c6fd13311b371e”,”top_tags”:{“tools”:275,”social”:1580,”delicious”:1193,…

The displayURL(data) callback sample function on that page prints out each of the tags (tools, social, delicious, etc.), but *not* their respective counts (275, 1580, 1193, etc.)

Question: How can I modify their displayURL() method they provide to also give the counts for each tag? I am wondering if this might be very difficult to do, because the names of the tags (tools, social, delicious) which are normally used to access the counts vary depending on the particular URL queried.

Thanks,
Glen

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jun 20.2007 — for in loop

basic idea, see if you can apply it:

<i>
</i>for(x in y){
alert(x + ":" + y[x]);
}


Eric
Copy linkTweet thisAlerts:
@mazzagauthorJun 20.2007 — Works like a charm! Many thanks.

Glen
×

Success!

Help @mazzag spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...