What is JSON Wire Protocol?

JavaScript Object Notation (JSON) is used to represent objects with complex data structures. It is used primarily to transfer data between a server and a client on the web. It has very much become an industry standard for various REST web services, playing a strong alternative to XML.

  1. A sample JSON file, saved as a .json file, will look as follows:
{
    "firstname": "John",
    "lastname": "Doe",
    "address": {
         "streetnumber":"678",
         "street":"Victoria Street",
          "city":"Richmond",
          "state":"Victoria",
          "country":"Australia"
     }
    "phone":"+61470315430" 
}
  • A client can send a person’s details to a server in the preceding JSON format, which the server can parse and create an instance of the Person object for use in its execution.
  • Later, the response can be sent back by the server to the client in the JSON format, the data of which the client can use to create an object of a class.
  • This process of converting an object’s data to the JSON format and JSON-formatted data to an object is named serialization and de-serialization, respectively, which is quite common in REST web services these days.
  • Our WebDriver uses the same approach to communicate between client libraries (language bindings) and drivers, such as Firefox Driver, IE Driver, Chrome Driver, and so on. Similarly, the RemoteWebDriver client and the RemoteWebDriver server use the JSON wire protocol to communicate among themselves