Solved

Need to view the JSON data

Posted on 2011-09-20
8
282 Views
Last Modified: 2012-05-12
I need to debug a problem in the Console but need to see the contents of an array of JSON objects.

How can I do this?

I know the format in C# of the object, which has a property Name. But when I use $(this).Name it comes back undefined. How can I access this property from a JSON object?

Thanks!
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 375 total points
ID: 36568654
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 125 total points
ID: 36568771
// this is you ajax callback part
function(data) {
     alert( data["Name"] ); // if you've something like { "Name":"mssmlfsfmslfk", "Id":123 }
// else try :
     alert( JSON.stringify(data) );
0
 

Author Comment

by:newbieweb
ID: 36568935
I can print data.Name and that prints the right name to the console. But I have trouble with this:

If (data.Name == "HI" )

what's wrong with my format?
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 40

Accepted Solution

by:
gurvinder372 earned 375 total points
ID: 36568961
nothing, does it give compilation error?
have you done this to it before
var data = eval(jsonData);
0
 

Author Comment

by:newbieweb
ID: 36569039
No, I have not. But the whole JSON object is linked to a jqGrid.
0
 

Author Comment

by:newbieweb
ID: 36569042
I use Firebug and Firefox. How do I find a compliance error?
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 375 total points
ID: 36569047
you should be able to see them on the console
0
 

Author Closing Comment

by:newbieweb
ID: 36569440
The problem involved being attached to the jqgrid, I think...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 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