JSON

Ads

 
 

Share on Google+Share on Google+

Rajasekhar
JSON
1 Answer(s)      5 years and 4 months ago
Posted in : Java Magazine

How do i fetch string values from client side and then parse it using JSON

Ads
View Answers

June 8, 2012 at 1:15 PM


The given code parse the message in JSON in JavaScript. You can parse the message with JSON in JavaScript by using the method "String.parseJSON(filter)". It parses the JSON message to an string or object. The parameter "filter" is optional in this method which is used to filter message or transform their results. This method internally uses the JavaScript's method eval() to parse messages.

<html>
    <head>
    <title>Parsing Message using JSON in JavaScript</title>
    <script language="javascript" src="json2.js"></script>
    <script language="javascript" >
    var students = {
       "Maths" : [ 
      { "Name"  : "Amit",  // First element
      "Marks" : 67,
      "age" : 23 },  
      {
       "Name"   : "Sandeep",  // Second element
      "Marks" : 65,
      "age" : 21 }
     ] 
     } 
    // Printing Maths array values in the alert message
    var i=0
    var arrayObject = new Array();
    for(i=0;i<students.Maths.length;i++)
    {  
      arrayObject.push(students.Maths[i].Name);
      arrayObject.push(students.Maths[i].Marks);
      arrayObject.push(students.Maths[i].age);
    }  
      alert("Parsing JSON Message Example ");
      alert(arrayObject.toJSONString().parseJSON());
    </script>
    </head>
    <body>
     Parsing Message using JSON in JavaScript
    </body>
    </html>

For more information, visit the following link:

http://www.roseindia.net/tutorials/json/creating-message-json.shtml


Ads









Related Tutorials/Questions & Answers:
json
json  how connect ajax with json
json
json  how to get data in json object from database
Advertisements
json
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... in JavaScript.While AJAX uses JSON format to communicate between client
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
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 "String.parseJSON(filter)". It parses the JSON message to an string or object
JSon Tutorial
JSon Tutorial  What is JSon? Where i can find the JSon tutorial? Thanks!   JSon Tutorial
JSON with Java
JSON with Java  How to request Json From URI and to parse and to store the values in Java array
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
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 json
Ajax json  Hi, How consume json file in ajax program? Thanks
JSON to HashMap
JSON to HashMap  Hi, How to convert a JSON String to HashMap in Java... following code for conversion of JSON String to HashMap: String jsonString = "Your JSON string"; HashMap<String,String> map = new Gson().fromJson
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
A better Java JSON library?
A better Java JSON library?   A better Java JSON library
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
JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use
JSON main question
JSON main question  What is the main purpose of JSON ,in which cases can i use
What is JSON?
What is JSON? In this article we are discussing about the JSON which... application. JSON- JavaScript Object Notation JavaScript Object Notation is a data... transfer from one place to another easy. Though JSON is based on Java Script
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
Version of rubygems>json dependency
List of Version of rubygems>json dependency
Version of com.tdunning>json dependency
List of Version of com.tdunning>json dependency
Version of com.twitter>json dependency
List of Version of com.twitter>json dependency
jQuery ajax json
jQuery ajax json  Hi, How to use jQuery to load json data through... to crate the json response: JSONObject obj=new JSONObject(); obj.put("name","foo..., textStatus, xhr) ] ) at client side to process the json data. Thanks
Version of com.metaparadigm>json-rpc dependency
List of Version of com.metaparadigm>json-rpc dependency
Version of ca.fuzzlesoft>json-compose dependency
List of Version of ca.fuzzlesoft>json-compose dependency
Version of com.arcticicestudio>icecore-json dependency
List of Version of com.arcticicestudio>icecore-json dependency
Version of com.datamountaineer>json-sql_2.11 dependency
List of Version of com.datamountaineer>json-sql_2.11 dependency
Version of com.identityblitz>json-lib dependency
List of Version of com.identityblitz>json-lib dependency
Version of com.metaparadigm>json-rpc dependency
List of Version of com.metaparadigm>json-rpc dependency
Version of com.qifun>json-stream_2.11 dependency
List of Version of com.qifun>json-stream_2.11 dependency
Version of com.theoryinpractise>halbuilder-json dependency
List of Version of com.theoryinpractise>halbuilder-json dependency
Version of com.mikesamuel>json-sanitizer dependency
List of Version of com.mikesamuel>json-sanitizer dependency

Ads

 
Advertisement null

Ads