This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

JavaScript Object Notation (JSON) support is included in the default distribution. JSON is another data exchangeable format like XML, but it is more lightweight and easily readable. It is based on a subset of Javascript language. Therefore, Javascript can understand JSON, and it can make Javascript objects by using JSON strings. JSON is based on key-value pairs and it uses colons to separate keys and values. JSON doesn't use end tags, and it uses braces (curly brackets) to enclose JSON Objects.

For example,

Code Block
<root><test>json object</test></root> == {“root”:{“test”:”json object”}}

When it comes to converting XML to JSON and vice versa, there are two major conventions, one named "Badgerfish" and the other, “Mapped.” The main difference between these two conventions exists in the way they map XML namespaces into JSON.

Code Block
<xsl:root xmlns:xsl=""><data>my json string</data></xsl:root>

This XML string can be converted into JSON as follows.

  • Using “Badgerfish”
Code Block
{"xsl:root":{"@xmlns":{"xsl":""},"data":{"$":"my json string"}}}
  • Using “Mapped”

If we use the namespace mapping as -> foo

Code Block
{"foo.root":{"data":"my json string"}}

Learn more information about JSON here.