Difference between revisions of "JSON/ko"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{JSON}} == Overview == [http://www.json.org JSON] (JavaScript Object Notation) is a form of data representation that provides a standardised data exchange format using simpl...")
 
Line 1: Line 1:
 
{{JSON}}
 
{{JSON}}
  
== Overview ==
+
== 소개 ==
 
[http://www.json.org JSON] (JavaScript Object Notation) is a form of data representation that provides a standardised data exchange format using simple text. As the name suggests, it is based on a subset of the JavaScript programming language; however, it is completely language-agnostic. Besides being easy for humans to read and write, it is also easy for machines to parse and generate.
 
[http://www.json.org JSON] (JavaScript Object Notation) is a form of data representation that provides a standardised data exchange format using simple text. As the name suggests, it is based on a subset of the JavaScript programming language; however, it is completely language-agnostic. Besides being easy for humans to read and write, it is also easy for machines to parse and generate.
  
Line 21: Line 21:
 
}</syntaxhighlight>
 
}</syntaxhighlight>
  
The name is supposed to be a string in double quotes, while the value can be any of the following:
+
문자열의 이름은 더블쿼터 안에 있어야 지원합니다, 다음사항을 참고하세요:
  
* a simple string, numeric, boolean or null value (strings are enclosed in double quotes):<br /><code>{"id":1, "name":"John Doe", "married":false}</code>
+
* 단순 문자열, 숫자, 불 또는 널 값  (문자열은 더블쿼터로 닫아야합니다.):<br /><code>{"id":1, "name":"John Doe", "married":false}</code>
  
* an array; which is a collection of comma-separated values in square brackets:<br /><code>{"primeNumbers":[2, 3, 5, 7, 11, 13, 17], "oddNumbers":[1,3,5,7]}</code>
+
* 배열; which is a collection of comma-separated values in square brackets:<br /><code>{"primeNumbers":[2, 3, 5, 7, 11, 13, 17], "oddNumbers":[1,3,5,7]}</code>
  
* an object; which is a collection of name:value pairs enclosed in curly brackets:<br /><code>{"address":{"street":"145 Koinange Street", "City":"Nairobi", "Country":"Kenya"}}</code>
+
* 오브젝트; which is a collection of name:value pairs enclosed in curly brackets:<br /><code>{"address":{"street":"145 Koinange Street", "City":"Nairobi", "Countㅇry":"Kenya"}}</code>
  
  
Line 43: Line 43:
  
  
== Valid JSON format ==
+
== JSON 포맷 ==
  
 
There are a few rules and guidelines that define the JSON syntax (see RFC 4627):
 
There are a few rules and guidelines that define the JSON syntax (see RFC 4627):
Line 62: Line 62:
 
* The MIME type for json files is '''application/json'''
 
* The MIME type for json files is '''application/json'''
  
== Implementations ==
+
== 구현 ==
 
JSON implementation is not very strict, and a lot of leeway is granted to the client application and/or parser to enforce the guidelines. As usual when writing code:
 
JSON implementation is not very strict, and a lot of leeway is granted to the client application and/or parser to enforce the guidelines. As usual when writing code:
 
* be liberal in what you accept  
 
* be liberal in what you accept  
Line 69: Line 69:
 
There are two main implementations of JSON:
 
There are two main implementations of JSON:
  
=== The official JSON Specification syntax ===
+
=== 일반적인 JSON 상세 구문 ===
 
This implementation adheres strictly to the RFC 4627 guidelines above and does not allow deviation from the specification.
 
This implementation adheres strictly to the RFC 4627 guidelines above and does not allow deviation from the specification.
  
=== The Javascript syntax ===
+
=== 자바스크립트 구문 ===
 
This implementation follows the implementation of the Javascript programming language and as such allows for a few deviations from the official specification. For example:
 
This implementation follows the implementation of the Javascript programming language and as such allows for a few deviations from the official specification. For example:
  
Line 79: Line 79:
 
#allows trailing comma after the last member of an array and/or object eg <code>{"keywords":["if","begin","for",], "IDEs":["Lazarus","fpIDE","MSEide"],}</code>
 
#allows trailing comma after the last member of an array and/or object eg <code>{"keywords":["if","begin","for",], "IDEs":["Lazarus","fpIDE","MSEide"],}</code>
  
== See also ==
+
== 같이보기 ==
  
 
* [[fcl-json]] package that implements JSON for FreePascal and Lazarus
 
* [[fcl-json]] package that implements JSON for FreePascal and Lazarus

Revision as of 03:46, 10 November 2016

English (en) suomi (fi) 日本語 (ja) 한국어 (ko) polski (pl) русский (ru) 中文(中国大陆)‎ (zh_CN)

소개

JSON (JavaScript Object Notation) is a form of data representation that provides a standardised data exchange format using simple text. As the name suggests, it is based on a subset of the JavaScript programming language; however, it is completely language-agnostic. Besides being easy for humans to read and write, it is also easy for machines to parse and generate.

Compared to XML, it is more human-readable.

JSON Object

A JSON Object is nothing more than a collection of comma-separated name/value pairs (often called members) enclosed in curly brackets:

{"name1":value1, "name2":value2 ...}

To make it easier for humans to read and visualize, the name/value pairs are often listed vertically:

{
	"name1": value1,
	"name2": value2
}

문자열의 이름은 더블쿼터 안에 있어야 지원합니다, 다음사항을 참고하세요:

  • 단순 문자열, 숫자, 불 또는 널 값 (문자열은 더블쿼터로 닫아야합니다.):
    {"id":1, "name":"John Doe", "married":false}
  • 배열; which is a collection of comma-separated values in square brackets:
    {"primeNumbers":[2, 3, 5, 7, 11, 13, 17], "oddNumbers":[1,3,5,7]}
  • 오브젝트; which is a collection of name:value pairs enclosed in curly brackets:
    {"address":{"street":"145 Koinange Street", "City":"Nairobi", "Countㅇry":"Kenya"}}


JSON objects can always be nested arbitrarily to create even more complex objects:

{"user":
	{	"userid": 1900,
		"username": "jsmith",
		"password": "secret",
		"groups": [ "admins", "users", "maintainers"]
	}
}


JSON 포맷

There are a few rules and guidelines that define the JSON syntax (see RFC 4627):

  • JSON objects are encapsulated within opening and closing brackets { }. An empty object can be represented by { }
  • Arrays are encapsulated within opening and closing square brackets [ ]. An empty array can be represented by [ ]
  • A member is represented by a key-value pair
  • The key of a member should be contained in double quotes
  • Each member SHOULD have a unique key within an object structure
  • The value of a member must be contained in double quotes if it is a string
  • Boolean values are represented using the true or false literals in lower case
  • Number values are represented using double-precision floating-point format; Scientific notation is supported; Numbers should not have leading zeroes
  • "Offensive" characters in a string need to be escaped using the backslash character
  • Null values are represented by the null literal in lower case
  • Other object types, such as dates, are not natively supported and should be converted to strings; to be managed by the parser/client
  • Each member of an object or each array value must be followed by a comma if it is not the last one
  • The common extension for json files is .json
  • The MIME type for json files is application/json

구현

JSON implementation is not very strict, and a lot of leeway is granted to the client application and/or parser to enforce the guidelines. As usual when writing code:

  • be liberal in what you accept
  • be strict (adhering to the standard) in what you send.

There are two main implementations of JSON:

일반적인 JSON 상세 구문

This implementation adheres strictly to the RFC 4627 guidelines above and does not allow deviation from the specification.

자바스크립트 구문

This implementation follows the implementation of the Javascript programming language and as such allows for a few deviations from the official specification. For example:

  1. allows un-quoted keys eg {name: "John Doe" }
  2. allows single quotes for keys and/or string values; and a liberal mix of single and double quotes eg {'name': "John Doe", "language":'Pascal'}
  3. allows trailing comma after the last member of an array and/or object eg {"keywords":["if","begin","for",], "IDEs":["Lazarus","fpIDE","MSEide"],}

같이보기

[[:{{{NameWithoutSuffix}}}/ru|한국어 (ru)]]