Activity Forums Salesforce® Discussions JSON vs XML in Salesforce

  • JSON vs XML in Salesforce

  • Kumar

    Member
    December 14, 2016 at 11:42 am

    Hi everyone,

    Why is JSON preferred over XML for data migration? I read somewhere that JSON is lighweight as compared to XML, but what does that mean exactly? Anyone with suggestions.

    Thanks

  • sushant

    Member
    January 10, 2017 at 1:46 pm

    Hi Kumar,

    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
    Con:

    Relatively wordy compared to JSON (results in more data for the same amount of information).

    Hope this helps you.

    Thanks

  • shariq

    Member
    September 19, 2018 at 1:27 pm

    Hi,

    Thanks

  • Parul

    Member
    September 19, 2018 at 5:19 pm

    Hi

    Adding some points:

    Extensible Markup Language (XML) used to be the only choice for open data interchange. However, developments in open data sharing have introduced more options for developers, each with their own set of benefits. While XML may be a widespread method for API integration, that doesn't mean it's the best choice for your project.

    JavaScript Object Notation (JSON) is one alternative that's attracting a lot of attention. The first thing that comes to mind when you mention JSON to developers is that it's lightweight compared to other open data interchange options. However, that's not the only reason you should use it for your next RESTful API integration. Consider these features.

     

    Thanks

Viewing 1 - 4 of 4 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos