How to Read Json Objects in C#
Filename extension | .json |
---|---|
Cyberspace media type | application/json |
Type lawmaking | TEXT |
Uniform Type Identifier (UTI) | public.json |
Type of format | Data interchange |
Extended from | JavaScript |
Standard | STD 90 (RFC 8259), ECMA-404, ISO/IEC 21778:2017 |
Open up format? | Yep |
Website | json |
JSON (JavaScript Object Annotation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit information objects consisting of aspect–value pairs and arrays (or other serializable values). It is a common data format with diverse uses in electronic data interchange, including that of web applications with servers.
JSON is a language-independent data format. It was derived from JavaScript, but many modern programming languages include lawmaking to generate and parse JSON-format data. JSON filenames use the extension .json
.
Douglas Crockford originally specified the JSON format in the early 2000s.[1] He and Bit Morningstar sent the offset JSON bulletin in April 2001.[two]
Naming and pronunciation [edit]
The acronym originated at State Software, a visitor co-founded by Douglas Crockford and others in March 2001.
The 2017 international standard (ECMA-404 and ISO/IEC 21778:2017) specifies "Pronounced , as in 'Jason and The Argonauts'".[3] [four] The first (2013) edition of ECMA-404 did not address the pronunciation.[5] The UNIX and Linux Organisation Assistants Handbook states that "Douglas Crockford, who named and promoted the JSON format, says it's pronounced similar the name Jason. But somehow, 'JAY-sawn' seems to take go more common in the technical customs."[6] Crockford said in 2011, "There's a lot of statement about how you pronounce that, but I strictly don't care."[seven]
Standards [edit]
Later on RFC 4627 had been bachelor every bit its "advisory" specification since 2006, JSON was first standardized in 2013, every bit ECMA-404.[8] RFC 8259, published in 2017, is the current version of the Internet Standard STD 90, and information technology remains consistent with ECMA-404.[nine] That same yr, JSON was too standardized equally ISO/IEC 21778:2017.[3] The ECMA and ISO standards depict only the immune syntax, whereas the RFC covers some security and interoperability considerations.[10]
History [edit]
JSON grew out of a need for stateless, real-time server-to-browser communication protocol without using browser plugins such every bit Flash or Coffee applets, the dominant methods used in the early 2000s.[11]
A precursor to the JSON libraries was used in a children's digital asset trading game project named Cartoon Orbit at Communities.com (at which State Software'southward co-founders had all worked previously) for Cartoon Network, which used a browser side plug-in with a proprietary messaging format to manipulate Dynamic HTML elements (this system is also owned past 3DO). Upon discovery of early Ajax capabilities, digiGroups, Noosh, and others used frames to pass information into the user browsers' visual field without refreshing a Web application's visual context, realizing existent-time rich Web applications using only the standard HTTP, HTML and JavaScript capabilities of Netscape 4.0.five+ and IE five+.[ citation needed ]
Crockford first specified and popularized the JSON format.[12] The Land Software co-founders agreed to build a arrangement that used standard browser capabilities and provided an abstraction layer for Spider web developers to create stateful Web applications that had a persistent duplex connectedness to a Web server past holding two Hypertext Transfer Protocol (HTTP) connections open up and recycling them before standard browser fourth dimension-outs if no further information were exchanged. The co-founders had a round-tabular array discussion and voted whether to call the information format JSML (JavaScript Markup Language) or JSON (JavaScript Object Notation), besides as under what license blazon to make it available. Chip Morningstar developed the idea for the State Application Framework at State Software.[13] [14]
The system was sold to Dominicus Microsystems, Amazon.com and EDS. The JSON.org[xv] website was launched in 2002. In December 2005, Yahoo! began offering some of its Web services in JSON.[16]
JSON was based on a subset of the JavaScript scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999[17]) and is commonly used with JavaScript, merely it is a language-independent data format. Lawmaking for parsing and generating JSON data is readily available in many programming languages. JSON's website lists JSON libraries by language.
In Oct 2013, Ecma International published the kickoff edition of its JSON standard ECMA-404.[8] That same year, RFC 7158 used ECMA-404 equally a reference. In 2014, RFC 7159 became the primary reference for JSON'southward Internet uses, superseding RFC 4627 and RFC 7158 (but preserving ECMA-262 and ECMA-404 as main references). In November 2017, ISO/IEC JTC i/SC 22 published ISO/IEC 21778:2017[three] as an international standard. On xiii December 2017, the Net Engineering Task Strength obsoleted RFC 7159 when information technology published RFC 8259, which is the current version of the Cyberspace Standard STD ninety.[18] [19]
Crockford added a clause to the JSON license stating that "The Software shall be used for Proficient, not Evil," in lodge to open-source the JSON libraries while mocking corporate lawyers and those who are overly pedantic. On the other mitt, this clause led to license compatibility problems of the JSON license with other open-source licenses, as open-source software and gratuitous software usually imply no restrictions on the purpose of use.[20]
Syntax [edit]
The following example shows a possible JSON representation describing a person.
{ "firstName" : "John" , "lastName" : "Smith" , "isAlive" : truthful , "age" : 27 , "address" : { "streetAddress" : "21 2nd Street" , "city" : "New York" , "state" : "NY" , "postalCode" : "10021-3100" }, "phoneNumbers" : [ { "blazon" : "habitation" , "number" : "212 555-1234" }, { "type" : "office" , "number" : "646 555-4567" } ], "children" : [], "spouse" : zip }
Character encoding [edit]
Although Crockford originally asserted and believed that JSON is a strict subset of JavaScript and ECMAScript,[21] his specification actually allows valid JSON documents that are non valid JavaScript; JSON allows the Unicode line terminators U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR to appear unescaped in quoted strings, while ECMAScript 2018 and older does non.[22] [23] This is a issue of JSON disallowing only "command characters". For maximum portability, these characters should be backslash-escaped.
JSON exchange in an open ecosystem must be encoded in UTF-8.[9] The encoding supports the full Unicode grapheme set, including those characters outside the Bones Multilingual Plane (U+10000 to U+10FFFF). All the same, if escaped, those characters must be written using UTF-xvi surrogate pairs. For case, to include the Emoji character U+1F610 😐 NEUTRAL Face up in JSON:
{ "face up" : "😐" } // or { "face" : "\uD83D\uDE10" }
JSON became a strict subset of ECMAScript as of the linguistic communication'due south 2019 revision.[23] [24]
Data types [edit]
JSON's basic data types are:
- Number: a signed decimal number that may contain a partial function and may employ exponential E note, just cannot include not-numbers such as NaN. The format makes no distinction betwixt integer and floating-point. JavaScript uses a double-precision floating-point format for all its numeric values (until later also supports BigInt[25]), but other languages implementing JSON may encode numbers differently.
- String: a sequence of zero or more Unicode characters. Strings are delimited with double-quotation marks and support a backslash escaping syntax.
- Boolean: either of the values
true
orfalse
- Array: an ordered list of zero or more elements, each of which may be of any type. Arrays use square bracket notation with comma-separated elements.
- Object: a drove of proper name–value pairs where the names (also called keys) are strings. The current ECMA standard states: "The JSON syntax does not impose any restrictions on the strings used as names, does not crave that proper name strings be unique, and does not assign any significance to the ordering of proper name/value pairs."[26] Objects are delimited with curly brackets and use commas to separate each pair, while within each pair the colon ':' grapheme separates the cardinal or name from its value.
-
null
: an empty value, using the wordnix
Whitespace is allowed and ignored around or between syntactic elements (values and punctuation, but not within a string value). Four specific characters are considered whitespace for this purpose: infinite, horizontal tab, line feed, and carriage render. In particular, the byte guild mark must not exist generated by a conforming implementation (though it may be accepted when parsing JSON). JSON does not provide syntax for comments.
Early versions of JSON (such as specified by RFC 4627) required that a valid JSON text must consist of just an object or an assortment type, which could contain other types within them. This restriction was dropped in RFC 7158, where a JSON text was redefined as any serialized value.
Numbers in JSON are agnostic with regard to their representation within programming languages. While this allows for numbers of arbitrary precision to be serialized, it may lead to portability problems. For example, since no differentiation is made between integer and floating-point values, some implementations may treat 42
, 42.0
, and 4.2E+1
as the same number, while others may not. The JSON standard makes no requirements regarding implementation details such as overflow, underflow, loss of precision, rounding, or signed zeros, simply it does recommend to expect no more than IEEE 754 binary64 precision for "good interoperability". In that location is no inherent precision loss in serializing a car-level binary representation of a floating-bespeak number (similar binary64) into a human-readable decimal representation (like numbers in JSON), and dorsum, since there exist published algorithms to exercise this exactly and optimally.[28]
Comments were intentionally excluded from JSON. In 2012, Douglas Crockford described his design decision thus: "I removed comments from JSON because I saw people were using them to hold parsing directives, a do which would have destroyed interoperability."
JSON disallows "trailing commas", a comma after the terminal value inside a information construction.[29] Trailing commas are a common feature of JSON derivatives to improve ease of use.[30]
Semantics [edit]
While JSON provides a syntactic framework for data interchange, unambiguous data interchange also requires agreement between producer and consumer on the semantics of specific use of the JSON syntax.[31] I example of where such an agreement is necessary is the serialization of data types defined by the JavaScript syntax that are not part of the JSON standard, e.g., Date, Role, Regular Expression, and undefined
.[32]
Metadata and schema [edit]
The official MIME type for JSON text is "application/json
",[33] and nigh mod implementations accept adopted this. The unofficial MIME blazon "text/json
" or the content-type "text/javascript
" are also supported for legacy reasons by many service providers, browsers, servers, web applications, libraries, frameworks, and APIs. Notable examples include the Google Search API,[34] Yahoo!,[34] [35] Flickr,[34] Facebook API,[36] Lift framework,[37] and Dojo Toolkit 0.4.[38]
JSON Schema specifies a JSON-based format to ascertain the structure of JSON data for validation, documentation, and interaction control. It provides a contract for the JSON data required past a given awarding, and how that data tin can be modified.[39] JSON Schema is based on the concepts from XML Schema (XSD), merely is JSON-based. As in XSD, the aforementioned serialization/deserialization tools can be used both for the schema and data, and information technology is self-describing. It is specified in an Internet Draft at the IETF, currently in 2020-12 draft, which was released on January 28, 2021.[xl] There are several validators available for different programming languages,[41] each with varying levels of conformance. There is no standard filename extension.[ citation needed ]
The JSON standard does not support object references, just an IETF typhoon standard for JSON-based object references exists.[42]
Uses [edit]
JSON-RPC is a remote procedure call (RPC) protocol built on JSON, equally a replacement for XML-RPC or Lather. It is a simple protocol that defines only a handful of data types and commands. JSON-RPC lets a system ship notifications (information to the server that does not require a response) and multiple calls to the server that tin be answered out of guild.
Asynchronous JavaScript and JSON (or AJAJ) refers to the same dynamic web page methodology as Ajax, but instead of XML, JSON is the information format. AJAJ is a web development technique that provides for the power of a webpage to asking new data after it has loaded into the web browser. Typically it renders new data from the server in response to user actions on that webpage. For example, what the user types into a search box, customer-side lawmaking then sends to the server, which immediately responds with a drop-downwardly list of matching database items.
While JSON is a data serialization format, it has seen ad hoc usage as a configuration language. In this use instance, support for comments and other features have been accounted useful, which has led to several nonstandard JSON supersets beingness created. Amidst them are HJSON,[43] HOCON, and JSON5 (which despite its name, isn't the fifth version of JSON).[44] [45] The primary objective of version i.2 of YAML was to make the nonstandard format a strict JSON superset.[46]
In 2012, Douglas Crockford had this to say about comments in JSON when used as a configuration language: "I know that the lack of comments makes some people deplorable, only information technology shouldn't. Suppose you are using JSON to keep configuration files, which you would like to annotate. Become ahead and insert all the comments you like. Then pipe it through JSMin[47] before handing it to your JSON parser."
JSON is intended as a information serialization format. However, its design as a subset of JavaScript can lead to the misconception that it is safe to pass JSON texts to the JavaScript eval ()
function. This is not safe, due to sure valid JSON texts, specifically those containing U+2028 LINE SEPARATOR or U+2029 PARAGRAPH SEPARATOR, not being valid JavaScript lawmaking until JavaScript specifications were updated in 2019, and so older engines may not support it.[48] To avoid the many pitfalls caused by executing arbitrary lawmaking from the Internet, a new function, JSON . parse ()
was get-go added to the fifth edition of ECMAScript,[49] which as of 2017 is supported by all major browsers. For non-supported browsers, an API-compatible JavaScript library is provided by Douglas Crockford.[50] In add-on, the TC39 proposal "Subsume JSON" made ECMAScript a strict JSON superset as of the language's 2019 revision.[23] [24]
Various JSON parser implementations have suffered from deprival-of-service assault and mass assignment vulnerability.[51] [52]
Comparison with other formats [edit]
JSON is promoted every bit a depression-overhead alternative to XML equally both of these formats have widespread support for creation, reading, and decoding in the real-globe situations where they are commonly used.[53] Autonomously from XML, examples could include CSV and YAML (a superset of JSON). Besides, Google Protocol Buffers can fill this role, although it is non a data interchange language.
YAML [edit]
YAML version 1.2 is a superset of JSON; prior versions were not strictly compatible. For instance, escaping a slash /
with a backslash \
is valid in JSON, simply was not valid in YAML.[46] YAML supports comments, while JSON does not.[46] [44]
XML [edit]
XML has been used to describe structured information and to serialize objects. Diverse XML-based protocols exist to represent the same kind of information structures as JSON for the same kind of data interchange purposes. Data can be encoded in XML in several ways. The most expansive form using tag pairs results in a much larger representation than JSON, but if data is stored in attributes and 'short tag' form where the endmost tag is replaced with />
, the representation is oftentimes near the same size as JSON or merely a piddling larger. However, an XML attribute can only have a unmarried value and each attribute can appear at most in one case on each element.
XML separates "data" from "metadata" (via the use of elements and attributes), while JSON does not have such a concept.
Some other key departure is the addressing of values. JSON has objects with a simple "central" to "value" mapping, whereas in XML addressing happens on "nodes", which all receive a unique ID via the XML processor. Additionally, the XML standard defines a common aspect xml:id
, that can be used by the user, to set up an ID explicitly.
XML tag names cannot contain whatever of the characters !"#$%&'()*+,/;<=>?@[\]^`{|}~
, nor a space graphic symbol, and cannot begin with -
, .
, or a numeric digit, whereas JSON keys tin (even if quotation marker and backslash must exist escaped).[54]
XML values are strings of characters, with no congenital-in type safety. XML has the concept of schema, that permits strong typing, user-defined types, predefined tags, and formal structure, allowing for formal validation of an XML stream. JSON has several types built-in, and has a like schema concept in JSON Schema.
XML supports comments, while JSON does non.[55]
Derivatives [edit]
Several serialisation formats have been built on or from the JSON specification. Examples include GeoJSON, JSON-LD, Smile (data interchange format), UBJSON, JSON-RPC, JsonML, JSON→URL.[56] and Lottie.[57]
See too [edit]
- Comparison of data serialization formats
- Amazon Ion – a superset of JSON
- Jackson (API)
- JSON streaming
- Due south-expression
References [edit]
- ^ "Douglas Crockford: The JSON Saga". YouTube. August 28, 2011. Retrieved February 21, 2022.
- ^ "A Deep Wait at JSON vs. XML, Office ane: The History of Each". Toptal Engineering Blog . Retrieved December 31, 2021.
- ^ a b c "ISO/IEC 21778:2017". ISO . Retrieved July 29, 2019.
- ^ "Standard ECMA-404 - The JSON Data Interchange Syntax" (PDF). Ecma International. December 2017. p. 1, footnote. Retrieved October 27, 2019.
- ^ ECMA-404: The JSON Data Interchange Format (PDF) (1st ed.). Geneva: ECMA International. October 2013.
- ^ Nemeth, Evi; Snyder, Garth; Hein, Trent R.; Whaley, Ben; Mackin, Dan (2017). "xix: Web Hosting". UNIX and Linux Arrangement Administration Handbook (fifth ed.). Addison-Wesley Professional. ISBN9780134278292 . Retrieved October 29, 2019.
- ^ "Douglas Crockford: The JSON Saga - Transcript Vids". transcriptvids.com . Retrieved October 29, 2019.
- ^ a b "The JSON Data Interchange Format" (PDF). ECMA International. Oct 2013. Retrieved October 24, 2019.
- ^ a b "The JavaScript Object Notation (JSON) Data Interchange Format". IETF. December 2017. Retrieved February sixteen, 2018.
- ^ Bray, Tim. "JSON Redux AKA RFC7159". Ongoing . Retrieved March 16, 2014.
- ^ "Unofficial Coffee History". Edu4Java. 26 May 2014. Archived from the original on 26 May 2014. Retrieved 30 August 2019.
In 1996, Macromedia launches Flash technology which occupies the infinite left by Java and ActiveX, condign the de facto standard for animation on the client side.
- ^ "Douglas Crockford — The JSON Saga". YouTube. August 28, 2011. Retrieved September 23, 2016.
- ^ "Chip Morningstar Biography". northward.d.
- ^ "State Software Breaks Through Web App Development Barrier". Washingtonindependant.com. 2013.
- ^ "JSON". json.org.
- ^ Yahoo!. "Using JSON with Yahoo! Spider web services". Archived from the original on October 11, 2007. Retrieved July 3, 2009.
- ^ Crockford, Douglas (May 28, 2009). "Introducing JSON". json.org. Retrieved July 3, 2009.
Information technology is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.
- ^ "History for draft-ietf-jsonbis-rfc7159bis-04". IETF Datatracker. Cyberspace Engineering Task Force. Retrieved October 24, 2019.
2017-12-xiii [...] RFC published
- ^ "RFC 8259 - The JavaScript Object Note (JSON) Information Interchange Format". IETF Datatracker. Internet Engineering Task Strength. Retrieved October 24, 2019.
Type: RFC - Net Standard (Dec 2017; Errata); Obsoletes RFC 7159; Besides known as STD 90
- ^ Apache and the JSON license on LWN.net by Jake Border (November 30, 2016)
- ^ Douglas Crockford (July x, 2016). "JSON in JavaScript". Archived from the original on July 10, 2016. Retrieved August thirteen, 2016.
JSON is a subset of the object literal annotation of JavaScript.
- ^ Holm, Magnus (May fifteen, 2011). "JSON: The JavaScript subset that isn't". The timeless repository. Archived from the original on May 13, 2012. Retrieved September 23, 2016.
- ^ a b c "Subsume JSON: Proposal to make all JSON text valid ECMA-262". Ecma TC39. Baronial 23, 2019. Retrieved August 27, 2019.
- ^ a b "Advance to Stage 4 - tc39/proposal-json-superset". GitHub. May 22, 2018.
- ^ "BigInt - MDN Web doc glossary". Mozilla . Retrieved October 18, 2020.
- ^ The JSON Data Interchange Syntax (PDF) (2nd ed.). Ecma International. December 2017. p. 3.
The JSON syntax does not impose any restrictions on the strings used as names, does not require that name strings be unique, and does not assign whatsoever significance to the ordering of proper name/value pairs.
{{cite book}}
: CS1 maint: date and twelvemonth (link) - ^ Andrysco, Marc; Jhala, Ranjit; Lerner, Sorin. "Press Floating-Indicate Numbers - An Always Correct Method" (PDF) . Retrieved July 27, 2019.
- ^ The JSON Data Interchange Syntax (PDF) (2d ed.). Ecma International. Dec 2017. p. 11.
A single comma token separates a value from a post-obit proper name.
{{cite book}}
: CS1 maint: date and year (link) - ^ "JSON5". json5. Archived from the original on November 29, 2020. Retrieved December 16, 2020.
- ^ "The JSON Data Interchange Syntax" (PDF). Ecma International. Dec 2017. Retrieved Oct 27, 2019.
The JSON syntax is non a specification of a consummate data interchange. Meaningful data interchange requires agreement between a producer and consumer on the semantics fastened to a detail apply of the JSON syntax. What JSON does provide is the syntactic framework to which such semantics tin can be attached
- ^ "ECMAScript 2019 Language Specification" (PDF). Ecma International. June 2019. Archived from the original (PDF) on April 12, 2015. Retrieved October 27, 2019.
- ^ "Media Types". iana.org . Retrieved September 13, 2015.
- ^ a b c "Handle application/json & text/json by benschwarz · Pull Request #2 · mislav/faraday-stack". GitHub . Retrieved September thirteen, 2015.
- ^ "Yahoo!, JavaScript, and JSON". ProgrammableWeb. December sixteen, 2005. Retrieved September 13, 2015.
- ^ "Make JSON requests let text/javascript content by jakeboxer · Pull Request #148 · AFNetworking/AFNetworking". GitHub . Retrieved September 13, 2015.
- ^ "lift/Req.scala at master · lift/lift · GitHub". GitHub . Retrieved September 13, 2015.
- ^ "BrowserIO.js in legacy/branches/0.4/src/io – Dojo Toolkit". dojotoolkit.org. Archived from the original on Jan 10, 2016. Retrieved September thirteen, 2015.
- ^ "JSON Schema and Hyper-Schema". json-schema.org . Retrieved June 8, 2021.
- ^ "typhoon-handrews-json-schema-00 - JSON Schema: A Media Type for Describing JSON Documents". json-schema.org/. January 28, 2021. Retrieved June 8, 2021.
- ^ "JSON Schema Implementations". json-schema.org . Retrieved June 8, 2021.
- ^ Zyp, Kris (September 16, 2012). Bryan, Paul C. (ed.). "JSON Reference: draft-pbryan-zyp-json-ref-03". Cyberspace Engineering Job Force.
- ^ Edelman, Jason; Lowe, Scott; Oswalt, Matt. Network Programmability and Automation. O'Reilly Media.
for data representation you tin can option ane of the post-obit: YAML, YAMLEX, JSON, JSON5, HJSON, or even pure Python
- ^ a b McCombs, Thayne. "Why JSON isn't a good configuration language". Lucid Chart. Retrieved June 15, 2019.
- ^ "HOCON (Human-Optimized Config Object Annotation)". GitHub. January 28, 2019. Retrieved Baronial 28, 2019.
The main goal is: proceed the semantics (tree construction; set of types; encoding/escaping) from JSON, but make it more convenient as a man-editable config file format.
- ^ a b c "YAML Ain't Markup Language (YAML™) Version i.2". yaml.org . Retrieved September 13, 2015.
- ^ Crockford, Douglas (May 16, 2019). "JSMin". Retrieved August 12, 2020.
JSMin [2001] is a minification tool that removes comments and unnecessary whitespace from JavaScript files.
- ^ "JSON: The JavaScript subset that isn't". Magnus Holm. Archived from the original on May 13, 2012. Retrieved May 16, 2011.
- ^ "ECMAScript Fifth Edition" (PDF). Archived from the original (PDF) on April fourteen, 2011. Retrieved March eighteen, 2011.
- ^ "douglascrockford/JSON-js". GitHub. August 13, 2019.
- ^ "Deprival of Service and Unsafe Object Creation Vulnerability in JSON (CVE-2013-0269)". Retrieved January 5, 2016.
- ^ "Microsoft .NET Framework JSON Content Processing Denial of Service Vulnerability". Retrieved Jan 5, 2016.
- ^ "JSON: The Fat-Costless Alternative to XML". json.org. Retrieved March 14, 2011.
- ^ "XML 1.1 Specification". World Wide Web Consortium. Retrieved Baronial 26, 2019.
- ^ Saternos, Casimir (2014). Client-server web apps with Javascript and Java. p. 45. ISBN9781449369316.
- ^ "JSON→URL Specification". Ongoing . Retrieved April ix, 2021.
- ^ "What is a Lottie animation? - LottieFiles". lottiefiles.com . Retrieved January xi, 2022.
External links [edit]
- Official website
- "ECMA-404 JSON Information Interchange Format" (PDF). ECMA Int'l.
- STD 90, JSON Data Interchange Format
Source: https://en.wikipedia.org/wiki/JSON
0 Response to "How to Read Json Objects in C#"
Post a Comment