Boomi Connector Tip: Using JSON Schema

Posted in

In the latest Boomi connector SDK, you can now write a custom connector to work with JSON profile instead of using the convention XML profile. So how to do this?

 

Let’s take the following JSON schema as an example:

 

{  
   "$schema":"https://json-schema.org/draft-04/schema#",
   "title":"Product set",
   "type":"array",
   "items":{  
      "title":"Product",
      "type":"object",
      "properties":{  
         "id":{  
            "description":"The unique identifier for a product",
            "type":"number"
         },
         "name":{  
            "type":"string"
         },
         "price":{  
            "type":"number",
            "minimum":0,
            "exclusiveMinimum":true
         }
      }
   }
}

 

The main object element in the JSON schema is “item”. In the connector browser, we just need to declare “item” as the element name (or they call in pointer in the connector) and specify the input and output type as below:

 

ObjectDefinition objDef = new ObjectDefinition();
objDef.setElementName("/" + elementName);
objDef.setInputType(ContentType.JSON);
objDef.setOutputType(ContentType.JSON);

objDef.setJsonSchema(jsonStr);

That’s all! Happy coding 😀

Get in touch today to see how WDCi can help your business.