Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
JSON
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== XML === {{Main|XML}} [[XML]] has been used to describe structured data and to serialize objects. Various XML-based protocols exist to represent the same kind of data 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 (in character count) representation than JSON, but if data is stored in attributes and ''short tag'' form where the closing tag is replaced with {{code|/>}}, the representation is often about the same size as JSON or just a little larger. However, an XML attribute can only have a single value and each attribute can appear at most once on each element. XML separates data from metadata (via the use of elements and attributes), while JSON does not have such a concept. Another key difference is the addressing of values. JSON has objects with a simple key-to-value mapping, whereas in XML addressing happens on ''nodes'', each of which receives a unique ID via the XML processor. Additionally, the XML standard defines a common attribute {{code|xml:id}}, that can be used by the user, to set an ID explicitly. XML tag names cannot contain any of the characters <code>!"#$%&'()*+,/;<=>?@[\]^`{|}~</code>, nor a space character, and cannot begin with {{code|-}}, {{code|.}}, or a numeric digit, whereas JSON keys can (even if quotation mark and backslash must be escaped).<ref name="XML 1.1">{{cite web |url=https://www.w3.org/TR/xml11/ |title=XML 1.1 Specification |publisher=World Wide Web Consortium |access-date=2019-08-26}}</ref> XML values are strings of ''characters'', with no built-in [[type safety]]. XML has the concept of [[XML schema|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 similar schema concept in [[#Metadata and schema|JSON Schema]]. XML supports comments, while JSON does not.<ref name=Saternos45>{{cite book|last1=Saternos|first1=Casimir|title=Client-server web apps with Javascript and Java|date=2014|isbn=9781449369316|page=45|publisher="O'Reilly Media, Inc." }}</ref><ref name=DouglasCrockfordComments/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)