Activity › Forums › Salesforce® Discussions › Why must one use JSON over XML in Salesforce?
Tagged: JSON, JSON Schema, Markup Language, Salesforce JavaScript, SGML, XML, XML schema, XPath, XQuery, XSLT
-
Why must one use JSON over XML in Salesforce?
Posted by Prachi on August 7, 2018 at 1:41 PMWhy must one use JSON over XML in Salesforce?
Parul replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Hello Prachi,
Comparison between JSON and XML is given below:
- Simplicity: XML is simpler than SGML, but JSON is much simpler than XML. JSON has a much smaller grammar and maps more directly onto the data structures used in modern programming languages.
- Extensibility: JSON is not extensible because it does not need to be. JSON is not a document markup language, so it is not necessary to define new tags or attributes to represent data in it.
- Interoperability: JSON has the same interoperability potential as XML.
- Openness: JSON is at least as open as XML, perhaps more so because it is not in the center of corporate/political standardization struggles.
These are the reasons why one must use JSON over XML.
- [adinserter block='9']
-
JSON
Pro:Simple syntax, which results in less “markup” overhead compared to XML.
Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.
JSON Schema for description and datatype and structure validation
JsonPath for extracting information in deeply nested structures
Con:Simple syntax, only a handful of different data types are supported.
XML
Pro:Generalized markup; it is possible to create “dialects” for any kind of purpose
XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
XSLT for transformation into different output formats
XPath/XQuery for extracting information in deeply nested structures
built in support for namespaces
Log In to reply.