json 데이터 형태 참고
http://www.copterlabs.com/blog/json-what-it-is-how-it-works-how-to-use-it/
WHAT IS JSON?
JSON is short for JavaScript Object Notation, and is a way to store information in an organized, easy-to-access manner. In a nutshell, it gives us a human-readable collection of data that we can access in a really logical manner.
Storing JSON Data
As a simple example, information about me might be written in JSON as follows:
12345 |
|
This creates an object that we access using the variable jason
. By enclosing the variable’s value in curly braces, we’re indicating that the value is an object. Inside the object, we can declare any number of properties using a "name": "value"
pairing, separated by commas. To access the information stored in jason
, we can simply refer to the name of the property we need. For instance, to access information about me, we could use the following snippets:
12 |
|
Storing JSON Data in Arrays
A slightly more complicated example involves storing two people in one variable. To do this, we enclose multiple objects in square brackets, which signifies an array. For instance, if I needed to include information about myself and my brother in one variable, I might use the following:
12345678910 |
|
To access this information, we need to access the array index of the person we wish to access. For example, we would use the following snippet to access info stored in family
:
12 |
|
NOTE: This is beneficial if it will be necessary to loop through stored information, as it lends itself to a for
loop with an automatically incrementing value.
Nesting JSON Data
Another way to store multiple people in our variable would be to nest objects. To do this, we would create something similar to the following:
123456789101112 |
|
Accessing information in nested objects is a little easier to understand; to access information in the object, we would use the following snippet:
123 |
|
Nested JSON and arrays can be combined as needed to store as much data as necessary.
'Jsp_Html' 카테고리의 다른 글
[Jsp] JSONP(JSON with padding)란? (0) | 2014.05.15 |
---|---|
[Jsp] JSP 라이브러리 정리 (0) | 2014.05.15 |
[Jsp] CSS style !important (0) | 2013.09.13 |
[Jsp] is quoted with " which must be escaped when used within the value (0) | 2013.07.25 |
[Jsp] DWR 설정 및 사용 (0) | 2012.12.12 |