JSON Arrays with Primitive Values

A JSON array contains zero or more ordered elements separated by commas and is enclosed in square brackets [].

In Event Publication Subscription, a JSON array can contain primitive data types, key-value pairs, JSON objects, and nested JSON arrays.

You can use primitive arrays when you need to include a list of simple values in a payload without wrapping each value in a JSON object. JSON arrays can contain the following primitive data types:

  • String. For example:
    {
      "fruits": ["apple", "banana", "cherry"]
    }
    
  • Number. For example:
    {
    "scores": [95, 88, 76, 85]
    }
    
  • Boolean. For example:
    {
      "permissions": [true, false, true, true]
    }
    
  • Null:
    {
      "values": [null, null, null]
    }
    

You can generate these payloads from Siebel server scripts or from external applications that publish events to EPS.

Examples of JSON Arrays with Primitive Values:

  • JSON array with string values:
    {
      "name": [
        "abc",
        "1",
        "2"
      ]
    }
    
  • Nested arrays that contain a combination of JSON objects and primitive values:
    {
      "array": [
        [
          {
            "key1": "value1"
          },
          "anotherchild"
        ],
        "abc",
        [
          "child1",
          "child2"
        ]
      ]
    }
    
  • EPS also supports arrays of primitive values within object properties. For example, JSON object with primitive string elements:
    {
      "Message": {
        "Property": [
          {
            "Name": "Color",
            "Values": [
              "Blue",
              "Red",
              "Green"
            ]
          },
          {
            "Name": "Size",
            "Values": [
              "S",
              "M",
              "L"
            ]
          }
        ]
      }
    }
    

    In this example, each Property object contains a Values array with primitive string elements.

  • Example of complex JSON objects and primitive values:
    {
      "bookstore": {
        "name": "Readers' Haven",
        "inventory": [
          {
            "category": "Fiction",
            "books": [
              {
                "bookId": "B001",
                "title": "The Great Gatsby",
                "editions": [
                  ["Edition", "Format", "Price"],
                  ["First", "Hardcover", 24.99],
                  ["Second", "Paperback", 14.99]
                ]
              },
              {
                "bookId": "B002",
                "title": "1984",
                "editions": [
                  ["Edition", "Format", "Price"],
                  ["First", "Hardcover", 22.99],
                  ["Second", "Paperback", 12.99]
                ]
              }
            ]
          }
        ]
      }
    }