Home Tutorialhelp Comment Minute correction to make the above code work

 
 

Comment

Omi
Minute correction to make the above code work,
June 16, 2009 at 10:36 PM

<html>
<head>
<title>
Array JSON-JavaScript Example
</title>
<script language="javascript" >

var students = { "Maths" : [
{"Name" : "Amit", // First element
"Marks" : 67,
"age" : 23 },
{
"Name" : "Sandeep", // Second element
"Marks" : 65,
"age" : 21 }
],
"Science" : [
{
"Name" : "Shaili", // First Element
"Marks" : 56,
"age" : 27 },
{
"Name" : "Santosh", // Second Element
"Marks" : 78,
"age" : 41 }
]
};
// Printing all array values
var i=0;
document.writeln("<table border='1'><tr>");
for(i=0;i<students.Maths.length;i++)
{
document.writeln("<td>");
document.writeln("<table border='0' width=100 >");
document.writeln("<tr><td><B>Name</B></td><td width=50>"
+students.Maths[i].Name+"</td></tr>");
document.writeln("<tr><td><B>Marks</B></td><td width=50>"
+students.Maths[i].Marks +"</td></tr>");
document.writeln("<tr><td><B>Age</B></td><td width=50>"
+students.Maths[i].age +"</td></tr>");
document.writeln("</table>");
document.writeln("</td>");
}
for(i=0;i<students.Science.length;i++)
{
document.writeln("<td>");
document.writeln("<table border='0' width=100 >");
document.writeln("<tr><td><B>Name</B></td><td width=50>"
+students.Science[i].Name+"</td></tr>");
document.writeln("<tr><td><B>Marks</B></td><td width=50>"
+students.Science[i].Marks +"</td></tr>");
document.writeln("<tr><td><B>Age</B></td><td width=50>"
+students.Science[i].age +"</td></tr>");
document.writeln("</table>");
document.writeln("</td>");
}
document.writeln("</tr></table>");
</script>
</head>
<body>
Using Array of objects via JSON in JavaScript
</body>
</html>
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Magazine Questions

JSON
it using JSON   The given code parse the message in JSON in JavaScript. You can parse the message with JSON in JavaScript by using the method..., visit the following link: http://www.roseindia.net/tutorials/json/creating 

Ajax Questions

json
Tutorials JSON Tutorials... data is transferred and how it is encoded. While JSON is a tool used for describing values and objects by encode the content in a very specific manner. 2)JSON 

JSON

What is JSON?
, JSON parser is used to make JSON work with other languages... Engineer" } Read more tutorials about JSON. Which programming language supports... can check the complete list at http://json.org/ Read more tutorials about JSON 

Ajax Questions

json
json  how connect ajax with json 

JavaScript Questions

json
json  how to get data in json object from database 

JavaScript Questions

Siverlight JSON
Siverlight JSON  how to use JSON in silverlight, i need to populate dynamic data by using JSON CAN ANY HELP ME   Hi Friend, Please go through the following link: http://www.roseindia.net/tutorials/json/ Thanks 

JavaScript Questions

retrieve JSON array objects in javascript
the following links: http://www.roseindia.net/tutorials/json/ArrayObject-json.shtml http://www.roseindia.net/tutorials/json/json-javascriptObject.shtml http://www.roseindia.net/tutorials/json/json-javascriptObject.shtml http://www.roseindia.net 

Mobile Applications Questions

json
json   how to develop iphone web service application using json. Please help me by giving any link where I could find an example or any help will be anticipated 

Java Beginners

JEE 7 JSON java.lang.NoClassDefFoundError: javax/json/Json
JEE 7 JSON java.lang.NoClassDefFoundError: javax/json/Json  Hi, While using the JSON in jee 7 based application I getting following errors...(Thread.java:724) Caused by: java.lang.NoClassDefFoundError: javax/json/Json 

JSON

JSON Tutorials
JSON Tutorials     ... tutorials: What is JSON? - Understand What... In the previous section of JSON tutorials you  have seen how JSON can be used 

JSON

Creating Message in JSON with JavaScript
Creating Message in JSON with JavaScript... about the JSON in JavaScript's some basic concepts of creating a simple object... a message with JSON in JavaScript. In this example of creating message in JSON 

Ajax

JSON-RPC
JSON-RPC       JSON-RPC-Java is a dynamic JSON-RPC implementation in Java. It allows you to transparently call server-side Java code from JavaScript with an included lightweight JSON-RPC 

J2EE

JEE7 JSON: How to use JEE 7 JSON API?
JEE7 JSON: How to use JEE 7 JSON API? In this tutorial I will explain you how you can use JEE 7 JSON API in your program for consuming and generating the JSON data on fly. The JSON stands for JavaScript Object Notation. The JSON 

Ajax Questions

jQuery ajax json
jQuery ajax json  Hi, How to use jQuery to load json data through Ajax request? Thanks   Hi, In Java you can use the following code to crate the json response: JSONObject obj=new JSONObject(); obj.put("name","foo 

Java Beginners

JSon Tutorial
JSon Tutorial  What is JSon? Where i can find the JSon tutorial? Thanks!   JSon Tutorial 

Java Beginners

How to sort json object?
How to sort json object?  I've been looking for a while and want a way to sort a JSON object like this: {"results": [ { "layerId": 5...", }, "geometryType": "esriGeometryPoint", } ]} I can't find any code 

JSON

JSON-JSP example
string value of that array object's index. Here is the example code of JSON...:   Download JSON-JSP Project code  ... JSON-JSP example      

Development process Questions

JSON with Java
JSON with Java  How to request Json From URI and to parse and to store the values in Java array 

JavaScript Questions

JSON array objects retrieval in javascript
("application/json"); response.getWriter().write(jsonObj.toString()); want to get above...JSON array objects retrieval in javascript   I am fetching some data... box is not populating any value, perhaps i am doing something wrong in json 

PHP Questions

How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP
How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP  Make HTTP Requests Using Curl and Decoding JSON Responses in PHP   ... to make request to other server like payment gateways integration, fetching catalog 

JSON

JSON in JavaScript
JSON in JavaScript       JSON stands for JavaScript Object Notation that ... conventions.  So in this section of JSON tutorial we are going to discuss 

Java Beginners

json and android
json and android  how can i use a json string [{"Id":10,"News":"sportnews"}] and fill a spinner for a android app?. i tried and i got a: AndroidRuntime:android.widget.ArrayAdapter.createViewFromResource(Adapter 

Ajax Questions

Ajax json
Ajax json  Hi, How consume json file in ajax program? Thanks 

JSON

JSON and Servlet example
-logging.jar, ezmorph.jar and json-lib-2.2.2-jdk15.jar.  Here is the example code.... Output: Download JSON-Servlet Project code  ... JSON and Servlet example    

Java Beginners

A better Java JSON library?
A better Java JSON library?   A better Java JSON library 

JSON

Parsing a message in JavaScript with JSON
Parsing a message in JavaScript with JSON... we have studied how to create message in JSON in JavaScript and now we will come to know that how we can parse the message in JSON in JavaScript. We can 

Mobile Applications Questions

what is json in iphone sdk
what is json in iphone sdk  What is json in iphone sdk? Is this a library and when i need to include JSon in my iPhone SDK App 

JavaScript Questions

JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use 

Ajax Questions

JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use 

Java Beginners

Jee 7 JSON error java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl
Jee 7 JSON error java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl  Hi, While creating jee 7 json based application I am getting... more JEE tutorials. Thanks   HI, Check more JEE tutorials. Thanks 

IDE Questions

Minute to Win It
Minute to Win It   Frnds i urgently need the code for an online game similar to cows and bulls played by two opponents. The game can be played... number may not begin with 0. Any number can be guessed in less than one minute 

JSON

Creating Array Objects in JavaScript with JSON
Creating Array Objects in JavaScript with JSON... of JavaScript-JSON tutorial you have known that how to create an object and now... in JavaScript-JSON. In our example file we have created an object "students" 

JavaScript Questions

accessing data from a json file writing javascript or using jQuery
page is built from this json file, but I can't figure out how to code... in json writing javascript. Here is some code: var novdata= { 'categories':[ {N...accessing data from a json file writing javascript or using jQuery  I 

JSON

JSONObject example in Java
;    In the previous section of JSON tutorials you  have seen how JSON can be used with JavaScript to create objects and arrays, you have also studied how to parse and create messages with JSON in JavaScript 

Java Beginners

Difference between jsonstring and json object
Difference between jsonstring and json object  Is There any difference between JsonString and jsonobjectA? if there is any differece could any one explain with example. Thanks venkatesh 

JSP Servlet Questions

Getting Json data from servlet to javascript variable
Getting Json data from servlet to javascript variable  How do i get json data from my servlet on to a variable in javascript n bind the data to display onto sigma grid.Has anyone Idea how to do 

Java Beginners

how to create this structure in json using grails
how to create this structure in json using grails  { "query": { "type": "cluster", "view": "accountActivity", "regions": [2342,334,241,13], "companies": [43228583,433421683,342427783], "departments": [1,2,4,6], "brands 

Java Beginners

MISTAKES CORRECTION - Java Beginners
for your early and helpfull reply. I shall once again to the practical work 

JavaScript Questions

Tree structure from json whose parents can be dragged and dropped from child
Tree structure from json whose parents can be dragged and dropped from child  I want to create tree structure whose parents will get adjusted... want to make child elements as parent then tree structure should look like 

Java Beginners

MISTAKES CORRECTION - Java Beginners
, P.Ravichristy  I used ur code which 

Ajax

JSON-RPC-Java
JSON-RPC-Java       JSON-RPC-Java is an AJAX RPC middleware that allows JavaScript DHTML web applications to call remote methods in a J2EE Application Server and Transparently maps Java 

Java Beginners

converting Json data into rows of DTO in java
converting Json data into rows of DTO in java  I am using jqxgrid, and I am able to access the json data in JAVA controller. But now my requirement...' number of ways to convert this JSON data into rows of DTO. I have used all 

WebSevices Questions

How to connect one application to some othe application through Rest json
How to connect one application to some othe application through Rest json  Hi All, Im new to Rest json How to connect one application to some othe application through Rest json? I need only Rest json plz help 

HTML Questions

call json object using url and represent in html tabular form
call json object using url and represent in html tabular form  how to call json object using url from html and represent in proper format it gives Json object after that i want to arrange the keys-values in table 

HTML Questions

call json object using url and represent in html tabular form
call json object using url and represent in html tabular form  how to call json object using url from html and represent in proper format it gives Json object after that i want to arrange the keys-values in table 

Programming Tutorials

Tutorial, Java Tutorials
Tutorials Here we are providing many tutorials on Java related technologies. All the tutorials are very useful for programmers. You can learn these tutorials very fast. These tutorials are well written and supported with good 

Java Beginners

import package.subpackage.* does not work
. A.java B.java C.java Below is the code block A.java:- package com.test...(); } } When i am compiling the above 3 class, i am getting an error message like... or make sure it appears in the correct subdirectory of the classpath 

Java Interview Questions

How can I initialize the JSONArray and JSON object with data?
How can I initialize the JSONArray and JSON object with data?  How can I initialize the JSONArray and JSONObject with data 

JSP Servlet Questions

How to get jSon object in servlet from jsp - JSP-Servlet
How to get jSon object in servlet from jsp  How to get jSon object in servlet from jsp? In jsp page i have written: var sel... variable in my configurationServlet. Can any one tel me how to get this json 

JSP Tutorials

JSP Tutorials - Page2
JSP Tutorials page 2 JSP Examples Hello World JSP Page... through the HTML code in the JSP page. You can simply use the <form><... of handling the form through the JSP code. This section provides JSP code which 

Java Beginners

NoughtsAndCrossesGame play button doesn't work
in the above loop but is shown separately here to make // it clearer...NoughtsAndCrossesGame play button doesn't work   /* * To change... main(String[] args) { // TODO code application logic here 

Java Beginners

NoughtsAndCrossesGame play button doesn't work
in the above loop but is shown separately here to make // it clearer...NoughtsAndCrossesGame play button doesn't work   /* * To change... main(String[] args) { // TODO code application logic here 

JEE Technologies

Oracle releases HTML 5 which focuses Java EE 7
, which reduces the need for a related code. It is also to be mentioned here... applications JSON Support:  It simplis data parsing and exchanging using JSON format  Support for RESTful Web Services with JAX-RS 

Java Beginners

Simple program to combine all html,ajax,java,servlets,jsp,json - Java Beginners
, I learned Java,servlets,jsp basics, html, ajax, json and css. I want to do... by ajax, server gets this value using servlet and the change it to json, then the json object was parsed then it will send again to the client page through jsp 

Blog

Site map - C Tutorials
; C Tutorials  | Java Tutorials | PHP Tutorials  | Linux Tutorials | WAP Tutorial  | Struts Tutorial  | Spring FrameWork Tutorial | MySQL Tutorials | XML Tutorial  |  VB 

JSP Tutorials

JSP Tutorials Resource - Useful Jsp Tutorials Links and Resources
JSP Tutorials         ....  By actually typing in the examples and getting them to work, you will gain...-building tools you normally use. You then enclose the code for the dynamic 

Spring 3

Spring MVC Tutorials
Spring MVC Tutorials and example code In this section I will provide you the list of Spring MVC Tutorials which is very useful for a beginner in Spring MVC.... This example of Spring MVC also make you understand about writing the code 

JSP Servlet Questions

How to Work - JSP-Servlet
to directly insert java code into jsp file, this makes the development process very... limitations of CGI programs. For read more information,examples and tutorials 

JSON

"JSONArray" example in Java
;     In this part of JSON tutorial you... and String or the JSONObject.NULL objects. To have functionality of JSON in your java program you must have JSON-lib. JSON-lib also requires following " 

PHP Tutorial

PHP Make Time
PHP  Make Time In PHP, mktime() funtion is used for doing date arithmetic... minute The number of the minute...; To calculate next day use the following code: <?php <?php 

Java-Tutorials

Tutorials on Java
anywhere can make use of them. Tutorials along with Video tutorials, examples... Tutorials on Java Tutorials on Java topics help programmers to learn... and work your way up the ladder by becoming proficient in the language. Following 

General

Java Swing Tutorials
Java Swing Tutorials       Java Swing tutorials -  Here you will find many Java Swing examples with running source code. Source code provide here are fully tested 

Submit-Tutorials

Submit Tutorials - Submitting Tutorials at RoseIndia.net
Submit Tutorials       Submitting Tutorials at RoseIndia.net is very easy. We welcome all members to submit their tutorials at RoseIndia.net. We are big tutorial web site 

Java-Tutorials

Catching Exceptions in GUI Code - Java Tutorials
the given below code to identify the uncaught exception : import...); gui.show(); } } First we compile and run this code using javaw.exe... stay pressed. When you run the same code using java.exe you will get 

Ajax Examples

Ajax Code Libraries and Tools
, JSON and TEXT ajax transactions. My-BIC has also been tested to work.... These properties make JSON an ideal data-interchange language. JSON is built... Ajax Code Libraries and Tools     

Software Development

HTML5 Tutorials
HTML 5 Tutorials In this section we have listed the tutorials of HTML 5... of HTML5  is to make browser as a application platform. Now HTML5 allows you... of HTML5 which helps the developers to make attractive UI for their web 

JSP Tutorials

JSF - Java Server Faces Tutorials
JSF - Java Server Faces Tutorials Complete Java Server Faces (JSF) Tutorial - JSF Tutorials. JSF Tutorials at Rose India covers... JSF tutorial comes with free source code and configuration files 

Java Beginners

why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...   public class d55 { int squares = 81; public static void main(String 

Java-Tutorials

Java HashMap - Java Tutorials
; map = new HashMap<String, Object>(); The difference between the above... implementation without any code compatibility problem. But this is not possible... the hash code for the invoking map. boolean isEmpty( )  Returns 

Servlets

Java : Servlet Tutorials
() function, which runs the code after every 1 minute... Java : Servlet Tutorials     ... easier to use Tomcat for learning Java Servlet. These step-by-step tutorials 

Java-Tutorials

Java Video Tutorials for beginners
Java Video Tutorials for beginners are being provided at Roseindia online for free. These video tutorials are prepared by some of the best minds of Java... tutorials showcase the practical implementation of programming, how a program 

Struts 2 Tutorials

What are Interceptors in Struts 2 and how do they work?
What are Interceptors in Struts 2 and how do they work? Understanding Struts 2.... Interceptors performs very important work during pre and post processing of any request... of interceptors is their ability to execute code before and after an Action is invoked 

Servlets

Servlet Tutorials Links
Servlet Tutorials Links      ... tutorial for writing HTTP Servlets with complete source code for the example Servlets.... What is servlet: Servlets are modules of Java code that run 

Ajax Examples

jQuery - jQuery Tutorials and examples
jQuery - jQuery Tutorials and examples   ... and jQuery Tutorials on the web. Learn and master jQuery from scratch. jQuery is nice piece of code that provides very good support for ajax. jQuery can be used 

General

Welcome to the MySQL Tutorials
MySQL Tutorial - SQL Tutorials   ... the password then make new user .This lesson you learn how to create new... popular database and make quick easy to store or its access, and update 

Ajax-Tutorial

Ajax Tutorials
these technologies work together - from an overview to a detailed look -- to make... Ajax Tutorials      ... computer. They might use the Internet to download updates, but the code 

General

Exception in Java - Java Tutorials
you compile the above code, you will get an error something like...;);} } Amazingly the above code compile without any hassle. Now, we try to run...Commenting Erroneous Code & Unicode newline Character In this section, you 

Java Beginners

how make excel
); } } } For the above code, you need Apache POI library. Thanks...how make excel  how make excel spreadsheet IN JAVA. please send this code argently   Hello Friend, Try the following code: import 

Java Beginners

how to make multiple rectangles
. please help my code as of now:(but this doesn't work) import java.awt.Color...how to make multiple rectangles  I,m a beginner , m sorry...(JFrame.EXIT_ON_CLOSE); //Set JFrame size setSize(400,400); //Make JFrame 

JSP Tutorials

How to make my first JSP page?
based application. In this tutorial you will learn how to make your web... is simple text file with .jsp extension and it contains HTML code along with embedded Java Code. JSP file is compiled into Servlet and then run 

Programming Tutorials

C++Tutorials
benefit to download the source code for the example programs, then compile... other tutorials, such as C++: Annotations by Frank Brokken and Karel Kubat...; The CPlusPlus Language Tutorial These tutorials explain the C++ language 

General

Java Field Initialisation - Java Tutorials
; } } In the above code you might me thinking that what is the necessity to initialize the variable above. But when you compile the above code... the initialization code is copied into all the constructor. For Example public 

Database-Tutorials

What is the difference between MongoDB and MySql?
than MySql will work perfectly but if a data is complex and you want to store serialized arrays or JSON objects then MongoDB is advised. MySql has JOIN operation, which allows it to work across multiple tables while MongoDB does 

Jobs

Write Tutorials and Earn Extra Cash
Write Tutorials and Earn Extra Cash       Write tutorials for our site and earn Extra Cash in your... hundred words and with correct example code ready to run. You can zip and send your 

Applet Questions

AWT Tutorials
;BODY> <APPLET ALIGN="CENTER" CODE="AppletExample.class" width = "260" height 

Java-Tutorials

Java Programming Tutorials for beginners
Java Programming tutorials for beginners are made in such a way... programming with ease. The Java tutorials available at Roseindia are prepared b... are seeking a breakthrough in the IT industry. Java tutorials that come under 

JDBC

JDBC (Java Database Connectivity) -Tutorials
JDBC (Java Database Connectivity) -Tutorials  ... for the above mentioned SQL-compliant databases. JDBC abstracts much... make these API calls for database access directly. The JDBC API provides 

JSP Tutorials

Tutorials - Java Server Pages Technology
. This can make it difficult to separate and reuse portions of the code when... Tutorials - Java Server Pages Technology   ..., and Java code, which is secure, fast, and independent of server platforms 

Java-Tutorials

Chart & Graphs Tutorials in Java
with source code to make this tutorial very user-friendly. Introduction... Chart & Graphs Tutorials in Java       Best collection of Graphs and Charts Tutorials 

Struts 1 Tutorials

Struts 1.1 Tutorials
Struts 1.1 Tutorials       This page is giving tutorials on Struts 1.1. Struts 1.1 was the earlier version of Struts... applications. In this section we have given the details and example code 

Ajax Questions

How to work with Ajax in spring
How to work with Ajax in spring  give some sample code for ajax with spring (example like if i select a state from one drop down in another drop down related districts should come 

General

JDK 1.4 the NullPointerException - Java Tutorials
]; System.out.println(string[1].charAt(1)); } } Code Description In the above... charAt() function, the above code throw NullPointerException. Output... of the above code You can Correct the above code as follows : package simpleCoreJava 

General

Commenting out your code - Java Tutorials
you compile the above code, you will get an error something like...;);} } Amazingly the above code compile without any hassle. Now, we try to run...Commenting Erroneous Code & Unicode newline Correct In this section, you 

Java Technology Tutorials

Java Example Codes and Tutorials
Java Tutorials - Java Example Codes and Tutorials Java is great programming... that cause common programming errors. Java source code files are compiled... Java programming tutorials: Core Java 

Development process Questions

any one help me in alfresco technology - Development process
and JSON materials.please any body can u responding my questions.  Hi friend, Code to give idea bout JSON : Array Object is =>...://www.roseindia.net/tutorials/json/ Thanks 

Training

Java Training and Tutorials, Core Java Training
and deletion of memory automatically, it helps to make bug-free code in Java... Java Training and Tutorials, Core Java Training Introduction to online Java tutorials for new java programmers.  Java is a powerful object 

Programming Tutorials

XML,XML Tutorials,Online XML Tutorial,XML Help Tutorials
that the parser produced by the above code will ignore comments.TransformerFactory factory... the Document BuilderFactory is used to create new DOM parsers. Methods used in code... the File. Xml code for the program generated 

Photoshop Tutorials

Photoshop - Photoshop Tutorials
design, I have not hard work here to make so don't worry. It is a easy...Photoshop - Photoshop Tutorials Photoshop is one of the most... Effect Here you will find many Photoshop tutorials 

Java Beginners

JFreeChart dosn't work
JFreeChart dosn't work  Hello everybody I'm trying to make a line chart from JFreechart, but I just can't get it to work. The graph get its data... it, an error occurs (i tried an example from here, with XY, and it didn't work either) I 

Mobile Applications Questions

learn jquery
learn jquery   is it possible to learn myself jquery,ajax and json   Yes, you can learn these technologies by yourself. Go through the following links: Ajax Tutorials JSON Tutorials JQuery Tutorials 

Advertisements Advertisements
 

 

 

DMCA.com