Solved

How display the following JSON object in html using Jquery

Posted on 2011-09-19
1
328 Views
Last Modified: 2012-05-12
hi, I have the following JSON object I need to display it using Jqury as a list of links like the following format:
1- <a href="Article_Url">Article_Title</a>
2- <a href="Article_Url">Article_Title</a>
...
Here is the JSON object:
{{"Columns":["id","Article_Url","Article_Title","Date","num"],"Rows":[["5bb93b83-d129-4ca9-8999-ed54910b824d","www.fomain.com//test.html","test","\/Date(1316189236173)\/",25],["82d62b61-d96b-489a-ae91-008b897db553","97.74.67.146/testx.html?xx=x","test","\/Date(1316256259490)\/",11],["97aaf346-1146-429e-bc5a-fcfa4b2d934b","97.74.67.146/testx.html","test","\/Date(1316255702510)\/",4],["2fea1222-e254-4db9-a68e-5129a0d87e8e","97.74.67.146/qn_news_story_s.asp?storyid=1093442005","Oman invests USD3.8b in constructing dry dock","\/Date(1316188504010)\/",2],["82fe900d-eefe-4540-87a4-1fe6057234a7","http://www.menafn.com/qn_news_story.asp?StoryId={83510500-a24b-4f87-9bf1-3985134ee4b6}","Title 1","\/Date(1315411910897)\/",1]]} 

Open in new window

0
Comment
Question by:Sindibad_123
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36562864
you need to remove the first accolade : {
{"Columns":["id","Article_Url","Article_Title","Date","num"],"Rows":[["5bb93b83-d129-4ca9-8999-ed54910b824d","www.fomain.com//test.html","test","\/Date(1316189236173)\/",25],["82d62b61-d96b-489a-ae91-008b897db553","97.74.67.146/testx.html?xx=x","test","\/Date(1316256259490)\/",11],["97aaf346-1146-429e-bc5a-fcfa4b2d934b","97.74.67.146/testx.html","test","\/Date(1316255702510)\/",4],["2fea1222-e254-4db9-a68e-5129a0d87e8e","97.74.67.146/qn_news_story_s.asp?storyid=1093442005","Oman invests USD3.8b in constructing dry dock","\/Date(1316188504010)\/",2],["82fe900d-eefe-4540-87a4-1fe6057234a7","http://www.menafn.com/qn_news_story.asp?StoryId={83510500-a24b-4f87-9bf1-3985134ee4b6}","Title 1","\/Date(1315411910897)\/",1]]} 

Open in new window


else use :
    $.each(json["Rows"], function(i,el) {
        $("#here").append("<a href=\"" + el[1] + "\">" + el[2] + "</a><br />");  
    })

TEST PAGE : http://jsfiddle.net/DxHQr/
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now