JSON

From WikiMD's medical encyclopedia

JSON vector logo
Douglas Crockford

JavaScript Object Notation (JSON) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

Overview

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

These are universal data structures that virtually all modern programming languages support, in one form or another. It is this universality that has contributed to JSON's success as a data interchange format.

Syntax

The JSON format is syntactically identical to the code for creating JavaScript objects. Because of this, a JSON data structure can be directly used in JavaScript, making it an ideal way to transmit data in web applications. A JSON object is written inside curly braces, with key/value pairs separated by commas. Keys are written as strings, followed by a colon, followed by the value associated with the key. Values can be strings, numbers, objects, arrays, true, false, or null.

MIME Type

The official MIME type for JSON is application/json.

JSONP

JSONP (JSON with Padding) is a method used to request data from a server residing in a different domain than the client. It is an effective workaround to browser restrictions, preventing web pages from making requests to a different domain than the one that served the web page.

Usage

JSON is widely used in web applications to exchange data between a browser and a server. The data can be sent from the server to the browser in JSON format and used directly in JavaScript scripts, or it can be converted from JSON to another format to be used in other types of applications. JSON is also used for storing and transporting data in other types of applications, making it a versatile format for data interchange.

Comparison with XML

JSON and XML are both widely used for data interchange on the web. JSON, however, is generally considered easier to read and write and less verbose than XML. JSON's lightweight nature makes it faster to parse and generate, leading to its widespread adoption, especially in web applications.

Security Considerations

While JSON is a powerful tool for data interchange, it is important to ensure that JSON data is properly validated and sanitized to prevent security vulnerabilities, such as injection attacks. When using JSONP, additional care must be taken to ensure the security of the data being transmitted, as it involves executing script received from a server.

See Also

Stub icon
   This article is a computing stub. You can help WikiMD by expanding it!



Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

Transform your life with W8MD's budget GLP-1 injections from $125.

W8mdlogo.png
W8MD weight loss doctors team

W8MD offers a medical weight loss program to lose weight in Philadelphia. Our physician-supervised medical weight loss provides:

NYC weight loss doctor appointments

Start your NYC weight loss journey today at our NYC medical weight loss and Philadelphia medical weight loss clinics.

Linkedin_Shiny_Icon Facebook_Shiny_Icon YouTube_icon_(2011-2013) Google plus


Advertise on WikiMD

WikiMD's Wellness Encyclopedia

Let Food Be Thy Medicine
Medicine Thy Food - Hippocrates

Medical Disclaimer: WikiMD is not a substitute for professional medical advice. The information on WikiMD is provided as an information resource only, may be incorrect, outdated or misleading, and is not to be used or relied on for any diagnostic or treatment purposes. Please consult your health care provider before making any healthcare decisions or for guidance about a specific medical condition. WikiMD expressly disclaims responsibility, and shall have no liability, for any damages, loss, injury, or liability whatsoever suffered as a result of your reliance on the information contained in this site. By visiting this site you agree to the foregoing terms and conditions, which may from time to time be changed or supplemented by WikiMD. If you do not agree to the foregoing terms and conditions, you should not enter or use this site. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates, categories Wikipedia, licensed under CC BY SA or similar.

Contributors: Prab R. Tumpati, MD