JSON examples

JSON objects and arrays can be transformed with transform actions. The following examples and the examples in the related topics, provide sample JSON objects and arrays and transformations of those objects and arrays. These examples demonstrate some JSON message processing that the DataPower® Gateway supports.

The examples illustrate transformation of JSON objects in a simple purchase order system. The following example JSON objects are customer purchase orders.
  • In this purchase order, John made a purchase of item 20223 for Jane.
    { "name"   : "John Smith",
      "sku"    : "20223",
      "price"  : 23.95,
      "shipTo" : { "name" : "Jane Smith",
                   "address" : "123 Maple Street",
                   "city" : "Pretendville",
                   "state" : "NY",
                   "zip"   : "12345" },
      "billTo" : { "name" : "John Smith",
                   "address" : "123 Maple Street",
                   "city" : "Pretendville",
                   "state" : "NY",
                   "zip"   : "12345" }
    }
  • In this purchase order, Alice sent a present to Bob.
    { "name"   : "Alice Brown",
      "sku"    : "54321",
      "price"  : 199.95,
      "shipTo" : { "name" : "Bob Brown",
                   "address" : "456 Oak Lane",
                   "city" : "Pretendville",
                   "state" : "HI",
                   "zip"   : "98999" },
      "billTo" : { "name" : "Alice Brown",
                   "address" : "456 Oak Lane",
                   "city" : "Pretendville",
                   "state" : "HI",
                   "zip"   : "98999" }
    }