Selasa, 05 Juni 2018

Sponsored Links

SQL Server 2016: JSON integration - TechNet Articles - United ...
src: social.technet.microsoft.com

In computing, JavaScript Object Notes or JSON ( "Jason", "Jay-sahn") is open-standard file formats that use human readable text to transmit data objects consisting of attribute-value pairs and array data types (or other serializable values). This is a very common data format used for asynchronous server-browser communications, including in place of XML in some AJAX-style systems.

JSON is a language-independent data format. It comes from JavaScript, but in 2017 many programming languages ​​include code to generate and parse JSON format data. The official type of Internet media for JSON is application/json . The JSON file name uses the .json extension.

Douglas Crockford originally determined the JSON format in the early 2000s; two competing standards, RFC 8259 and ECMA-404, define it in 2017. The ECMA standard only describes the allowed syntax, while the RFC includes some security and interoperability considerations.

The limited JSON profile, known as I-JSON (short for "JSON Internet"), attempts to resolve some interoperability issues with JSON. This is defined in RFC 7493.


Video JSON



History

JSON grew out of the need for stateful and real-time server-to-browser protocols without the use of browser plugins like Flash or Java applets, the dominant method used in the early 2000s.

Douglas Crockford first determined and popularized the JSON format. The acronym is derived from State Software, a company co-founded by Crockford and others in March 2001. The co-founders agreed to build systems that use standard browser capabilities and provide a layer of abstraction for Web developers to create Web applications that have persistent duplex connections to the server Web by holding two open HTTP connections and recycling them before standard browser time limits if no further data are exchanged. The co-founders held a round table discussion and chose whether to call the JSML or JSON data format, as well as under what type of license to make it available. Crockford, inspired by the words of President Bush, should also be credited with coming up with a JSON "malware-perpetrator" license ("Software will be used for Good, not Crime.") To open the JSON-source library, but force (troll ) corporate lawyers, or those who are too long-winded, to seek to pay for a license from the State. The Morningstar chip develops ideas for the State Application Framework in State Software. On the other hand, this clause causes the compatibility issue of JSON license licenses with other open-source licenses.

Precursors for JSON libraries are used in the children's digital asset trading project called Cartoon Orbit at Communities.com (the founders of the State have worked at this company before) for Cartoon Network, which uses browser-side plug-ins with exclusive messaging format to manipulate DHTML element (this system is also owned by 3DO). After discovering the initial Ajax capabilities, digiGroups, Noosh, and others use frames to pass information to the user's visual area of ​​the browser without refreshing the visual context of Web applications, realizing real-time rich web applications that only use standard HTTP, HTML and JavaScript capabilities Netscape 4.0.5 and IE 5. Crockford later found that JavaScript can be used as an object-based message format for such systems. The system is sold to Sun Microsystems, Amazon.com and EDS. The JSON.org website was launched in 2002. In December 2005, Yahoo! started offering some of its Web services on JSON.

JSON was originally intended to be part of the JavaScript scripting language (in particular, Standard ECMA-262 3rd Edition - December 1999) and is generally used with Javascript, but it is a language-independent data format. The code for parsing and generating JSON data is already available in many programming languages. The JSON website lists JSON libraries by language.

Although JSON was originally advertised and believed to be a subset of JavaScript and ECMAScript strictly, it inadvertently allows some non-trackable characters in strings that are illegal in JavaScript and ECMAScript string literals. See the Data portability issue below.

JSON itself became the international standard of ECMA in 2013 as ECMA-404 standard. In the same year RFC 7158 used ECMA-404 as reference. In 2014 RFC 7159 became the main reference for JSON internet use (eg MIME/json Application), and obsoletes RFCÃ, 4627 and RFCÃ, 7158 (but maintaining ECMA-262 and ECMA-404 as the main reference). In December 2017, RFC 7159 was made obsolete by RFC 8259.

Maps JSON



Data types, syntax and examples

JSON basic data types are:

  • Number: an unmarked decimal number that can contain fractional parts and can use exponential E notation, but can not include non-numbers such as NaN. The format does not distinguish between integer and floating-point. JavaScript uses a double-precision floating-point format for all its numerical values, but other languages ​​that implement JSON can encode the numbers differently.
  • String: the order of zero or more Unicode characters. Strings are limited by double quotes and support blurred backslash syntax.
  • Boolean: one of the values ​​ true or false
  • Array: a list of sequences of zero or more values, each of which can be of any type. Array using square bracket notation and comma-separated elements.
  • Object: a set of non-consecutive value-name pairs where names (also called keys) are strings. Since the object is meant to represent an associative array, it is recommended, though not necessary, that each key is unique within an object. Objects are limited by curly braces and use commas to separate each pair, while in each pair the character ':' character separates the key or name from its value.
  • null : Empty value, using the word null

Limited unlimited space is allowed and ignored around or between syntactic elements (values ​​and punctuation, but not in string values). Only four specific characters are considered spaces for this purpose: space, horizontal tabs, line feeds, and carriage deliveries. Specifically, the byte sequence mark should not be generated by the appropriate implementation (although that is acceptable when parsing JSON). JSON does not provide syntax for comments.

The initial version of JSON (as specified by RFCÃ, 4627) requires that a valid "JSON" document must consist of only an object or array type, which may contain other types within it.

Example

The following example shows a JSON representation that might describe a person.

Data portability issues

Although Douglas Crockford initially asserted that JSON is a strict JavaScript subset, the specification actually allows valid JSON documents that are invalid JavaScript. Specifically, JSON allows terminator of Unicode line U 2028 LINE SEPARATOR and U 2029 PARAGRAPH SEPARATOR appears unescaped in the citation string, while JavaScript is not. This is a consequence of JSON which prohibits only "control characters". For maximum portability, this character must be backslash-escape. Subtlety is important when generating JSONP.

JSON exchanges in open ecosystems must be encoded in UTF-8. The encoding supports a full Unicode character set, including characters outside the Multilingual Plane (U 10000 to U 10FFFF). However, if passed, the character must be written using a UTF-16 surrogate pair, details passed by some JSON parsers. For example, to include Emoji characters U 1F602 ? FACE WITH TEARS OF JOY in JSON:

Figures in JSON are agnostic with respect to their representation in programming languages. No differences are made between integer and floating-point values: some implementations can treat 42 , 42.0 , and 4.2E 1 as the same number while others do not. In addition, no requirements are made regarding implementation issues such as overflow, underflow, loss of precision, or rounding. Additionally, JSON does not say anything about zero treatment that is marked: is 0,0 different from -0.0 . Most implementations that use the IEEE 754 floating-point standard, including JavaScript, retain signed zeroes; but not all JSON implementations can do so.

Using JSON in JavaScript

By 2018, all major browsers support at least a fifth edition of ECMAScript that provides a secure and fast JSON decode method:

Unsupported original data type

Syntax JavaScript defines some original data types that are not included in the JSON standard: Map, Set, Date, Error, Regular Expression, Function, Promise, and undefined . This type of JavaScript data should be represented by several other data formats, with programs at both ends agreeing on how to convert between types. In 2011, there were some de facto standards, for example. , convert from Date to String, but none is universally recognized. Other languages ​​may have different original types that should be carefully catalyzed to handle this type of conversion.

How to Encode, Send and Receive JSON Data Using the Pythom MQTT ...
src: i.ytimg.com


Schemes and metadata

JSON Schema

JSON Schema specifies a JSON-based format for specifying JSON data structures for validation, documentation, and interaction control. This provides a contract for the JSON data required by the given application, and how the data can be modified.

JSON Schema is based on the concept of XML Schema (XSD), but based on JSON. As with XSD, the same serialization/deserialization tool can be used for both schema and data; and describe themselves. This is described in the current Internet Draft in the 6th draft, released on April 15, 2017. Draft 4 ends on August 4, 2013, but continues to be used over an interval of more than 3 years between expiration and discharge. Draft 5. There are several validators available for different programming languages, each with varying degrees of conformity.

There is no standard file extension, but some suggest .schema.json .

Contoh JSON Schema (draft 4):

The above JSON scheme can be used to test the validity of JSON code below:

JSON Formatter for Eclipse - Stack Overflow
src: i.stack.imgur.com


MIME Type

The official MIME type for JSON text is " application/json ", and most modern implementations have adopted this.

The MIME type (unofficial) " text/json " or the " text/javascript " content type also gets legacy support by many service providers, browsers, servers, web apps, libraries , framework, and API. Important examples include Google Search API, Yahoo !, Flickr, Facebook API, Lift framework, Dojo Toolkit 0.4, etc.

Convert Data from Mysql to JSON Formate using PHP - YouTube
src: i.ytimg.com


Apps

JSON-RPC

JSON-RPC is a remote procedure call protocol (RPC) built in JSON, in place of XML-RPC or SOAP. This is a simple protocol that defines only a handful of types and data commands. JSON-RPC allows the system to send notifications (information to servers that do not require a response) and multiple calls to the server that can be answered do not work. Examples of JSON-RPC 2.0 requests and responses use position parameters.

AJAJ

Asynchronous JavaScript and JSON (or AJAJ) refer to the same dynamic web page methodology as Ajax, but instead of XML, JSON is the data format. AJAJ is a web development technique that provides the ability of a web page to request new data once it's loaded into a web browser. This typically creates new data from the server in response to user actions on the web page. For example, what users type into the search box, the client-side code then sends to the server, which responds immediately with a drop-down list of matching database items.

The following JavaScript code is an example of a client using XMLHttpRequest to request data in JSON format from the server. (Server-side programming is omitted; it must be set to serve the request to url containing the JSON formatted string.)

SQL Server 2016: JSON integration - TechNet Articles - United ...
src: social.technet.microsoft.com


Security considerations

JSON is intended as a data serialization format. However, designing it as a non-strict JavaScript subset can lead to the misconception that it is safe to pass JSON strings to JavaScript. eval () works. This is not safe, due to the fact that a certain valid JSON string is actually not a valid JavaScript code.

To avoid the many pitfalls caused by executing arbitrary code from the internet, a new function, JSON . parse () was first added to the fifth edition of ECMAScript, which in 2017 is supported by all major browsers. For unsupported browsers, API-compatible JavaScript libraries are provided by Douglas Crockford.

JSON Parsing and Image Loading Tutorial - Android Studio - YouTube
src: i.ytimg.com


Vulnerability in certain JSON parser

Various implementations of JSON parsers have suffered from denial-of-service attacks and mass-task vulnerabilities.

Serialisation - JSON in C#, using Json.NET â€" src="http://i0.wp.com/imgstorage.ga/wp-contents/uploads/2018/06/.jpg" style="max-width: 100%; height: auto;" title="Serialisation - JSON in C#, using Json.NET â€" GameDev">
src: genericgamedev.com


Reference object

The JSON standard does not support object references, but the IETF draft standard for JSON-based object references exists. Dojo Toolkit supports object references using standard JSON; in particular, the dojox.json.ref module provides support for some form of reference including circular references, many, inter-messages, and lazy. Alternatively, non-standard solutions exist such as the use of Mozilla JavaScript Sharp Variables. However this functionality is obsolete with JavaScript 1.8.5 and removed in Firefox version 12.

Fetch JSON Data & Insert into Mysql table in PHP - YouTube
src: i.ytimg.com


Comparison with other formats

JSON is promoted as a low cost alternative to XML because both formats have extensive support for creation, reading and decrypting in real-world situations where they are commonly used. In addition to XML, examples may include OGDL, YAML and CSV. In addition, Google Protocol Buffer can fill this role, even though this is not a data exchange language.

YAML

YAML version 1.2 is a superset of JSON; previous version "not fully compatible". For example, out of slash (/) with backslash (\) applies in JSON, but does not apply in YAML. (This is a common practice when injecting JSON into HTML to protect against cross-site scripting attacks.) Nevertheless, many YAML parsers can naturally outline the output of many JSON encoders.

XML

XML has been used to describe structured data and to create object stories. Various XML-based protocols exist to represent the same type of data structure as JSON for the purpose of exchanging the same data. Data can be encoded in XML in several ways. The most widespread form of using a tag pair produces a much larger representation than JSON, but if data is stored in attributes and 'short tags' where the closing tag is replaced by '/& gt;', the representation is often about the same size as JSON or simply slightly larger. If data is compressed using algorithms such as gzip, there is little difference because of good compression in saving space when patterns are repeated.

XML also has a schema concept. This allows strong typing, user-defined types, predefined tags, and formal structure, enabling formal validation of XML streams in a portable way. Similarly, there is an IETF draft proposal for a scheme system for JSON.

XML supports comments, but JSON does not.

Sample

Sample JSON

The following two examples carry the same type of information as the JSON example above in a different way.

YAML samples

The above JSON code is also fully valid YAML. YAML also offers an alternative syntax that is intended to be more accessible to humans by replacing marked borders such as {} , [] , and " with off- out side.

XML Example

Properties can also be serialized using attributes rather than tags:

The XML encoding may be therefore proportional to the length of the equivalent JSON coding. A variety of XML processing technologies exist, from Document Object Model to XPath and XSLT. XML can also be styled for direct viewing using CSS. XHTML is an XML form so elements can be passed in this form ready for direct insertion to web pages using client-side script.

Project Facebook
src: www.virtualsecrets.com


See also

  • JSON stream
  • Other formats
    • HOCON - Human-Optimized Object Setup Notes, JSON superset
    • YAML - Another data storage format that is a superset of JSON
    • S-expression - a comparable LISP format for the tree as text.
    • JSONP - JSON with Padding, the commonly used pattern of use when fetching JSON across domains
    • GeoJSON - open format for encoding various geographic data structures
    • JSON-LD - JavaScript object notation for linked data, W3C recommendations
    • JSON-RPC
    • SOAPjr - SOAP and JR hybrids (JSON-RPC)
    • JsonML
  • Binary encoding for JSON
    • BSON
    • MessagePack
    • Smile
    • UBJSON
    • EXI4JSON (EXI for JSON) - representation using the standard Efficient XML Interchange (EXI)
  • Deployment:
    • Jayrock - an open source JSON implementation for the.NET Framework.
    • Buckets of data server implementations for PHP, Node.js, Ruby, Python, Go,.NET, and Java.
    • Jackson for Java.
  • More
    • Comparison of data serialization formats
    • Jq

JSON Editor eclipse plugin - YouTube
src: i.ytimg.com


Note


BibSonomy Blog: Feature of the Week: API outputs JSON instead of XML
src: 1.bp.blogspot.com


References


Convert Excel to JSON with Javascript - YouTube
src: i.ytimg.com


External links

  • Official website
  • " ECMA-404 JSON Data Interchange Format " (pdf) . ECMA Int'l.
  • RFCÃ, 8259, JSON Passers Data Format
  • RFCÃ, 7049, Representation of Compact Binary Objects (CBOR) for JSON
  • "JSON Validator". JSON lint .
  • "JSON Formatter". JSON Formatter .
  • "JSON for Office". - Use of format JSON in Office suite & amp; detailed information about JSON parsing

Source of the article : Wikipedia

Comments
0 Comments