1. JSON stands for "Java Script Object Notation".
2. We generally use JSON for information exchange between two entities. Entity's may be two methods, two computers connected in network, mobile and server etc. In any case you can use JSON format for information exchange.
3. Sometimes we can use JSON for storing information. We may store information in file with low space and processing power. Generally we use JSON and XML databases with low power processing devices like mobiles, where there are many limitations.
4. JSON is running with many characteristics as given below,
a. JSON is platform independent.
b. JSON is language independent.
c. JSON is light weight.
d. Much like XML but less complicated.
5. JSON parser's are available in nearly each language. Here I am giving sample JSON format,
Ex.
{
"Major1" : "Record1",
"Major2" : [{"Minor1" : "Record2"},
{"Minor2" : "Record3"}
]
}
This means under key "Major1" we have value "Record1", under key "Major2" we have another key value pairs which are {"Minor1" : "Record2"} and {"Minor2" : "Record3"}.
In short this JSON format always works in key value pair.
6. If you want to validate your JSON, then there are number of online JSON validators are available.
Just google it with search string "Online JSON validators".
7. Here is simple code for JSON extraction in java,
public String getElement(jsonString, key) {
JSONObject jo=new JSONObject(jsonString);
return jo.get(key).toString();
}
2. We generally use JSON for information exchange between two entities. Entity's may be two methods, two computers connected in network, mobile and server etc. In any case you can use JSON format for information exchange.
3. Sometimes we can use JSON for storing information. We may store information in file with low space and processing power. Generally we use JSON and XML databases with low power processing devices like mobiles, where there are many limitations.
4. JSON is running with many characteristics as given below,
a. JSON is platform independent.
b. JSON is language independent.
c. JSON is light weight.
d. Much like XML but less complicated.
5. JSON parser's are available in nearly each language. Here I am giving sample JSON format,
Ex.
{
"Major1" : "Record1",
"Major2" : [{"Minor1" : "Record2"},
{"Minor2" : "Record3"}
]
}
This means under key "Major1" we have value "Record1", under key "Major2" we have another key value pairs which are {"Minor1" : "Record2"} and {"Minor2" : "Record3"}.
In short this JSON format always works in key value pair.
6. If you want to validate your JSON, then there are number of online JSON validators are available.
Just google it with search string "Online JSON validators".
7. Here is simple code for JSON extraction in java,
public String getElement(jsonString, key) {
JSONObject jo=new JSONObject(jsonString);
return jo.get(key).toString();
}
Now you can call this getElement function to get value of specific key.
8. Here is simple code in java script,
var JSONObject = {"name" : "This is name"};
Now if you want value of name then use,
JSONObject.name;
That's it.
9. In this way you can construct string at the side from where you want to send data and at receiving end simply extract data using JSON extraction facility provided by language.
9. In this way you can construct string at the side from where you want to send data and at receiving end simply extract data using JSON extraction facility provided by language.
No comments:
Post a Comment