Back to home

Documentation

Learn how to use Inolio.

JSON Schema

To define the structure and requirements for your input data, Inolio utilizes JSON Schema. This schema acts as a blueprint for Inolio to extract and format your unstructured data correctly. Below is a guide to understanding and writing a JSON schema for use with Inolio.

Understanding JSON Schema

Inolio's JSON schema is array of objects, each object representing a single field in your data. Each field object has a number of properties that define how Inolio should extract and format the data. Properties of each field object can vary depending on the type of field you are defining. Below is a list of all the properties that is available for each field object:

  1. name - The name of the field, this is used to identify the field in the output data.
  2. description - A description of the field, this is used to describe the field in the output data.
  3. type - The type of field, this is used to determine how the field should be extracted and formatted. See below for a list of available types.
    • string - A string value.
    • number - A number value.
    • integer - An integer value.
    • boolean - A boolean value.
    • array - An array of values.
    • object - An object of values.
  4. isRequired - A boolean value that determines if the field is required or not.

Now that you understand the basic structure of a field object, let's break down the specific constructs based on the type of data you will define using the given schema:

String

Additional properties for string fields:

  1. choices (optional) - An array of strings that define the possible values for the field. This can be used to restrict the possible values for the field.

Example:

{ "name": "firstName", "description": "The first name of the individual.", "type": "string", "isRequired": true }
{ "name": "reviewCategory", "description": "which department the review is for.", "type": "string", "isRequired": true, "choices": [ "sales", "marketing", "customer service" ] }

Number and Integer

For numerical data fields, additional properties are available to define the range of values for the field:

  1. minimum (optional) - The minimum value for the field.
  2. maximum (optional) - The maximum value for the field.

Example:

{ "name": "age", "description": "The age of the individual.", "type": "integer", "isRequired": true, "minimum": 0, "maximum": 100 }

Boolean

Boolean fields are simple, they don't have any additional properties.

Example:

{ "name": "isMarried", "description": "Is the individual married?", "type": "boolean", "isRequired": true }

Array

Array type fields are used to define a list of values. Additional properties here are used to define the type of values in the array and is required:

  • children - object that defines the type of values in the array. This object can only have one field: type. Simmilar to the type property of a field object, this property defines the type of values in the array and can be any of the types listed above.

Example:

{ "name": "hobbies", "description": "A list of hobbies.", "type": "array", "isRequired": true, "children": { "type": "string" } }

Object

Object type fields are used to define a set of values. Additional properties here are used to define the fields in the object and is required:

  • children - array of objects that define the fields in the object. You can think of this as a nested JSON schema, thus the properties of each field object are the same as the properties of the field object in the root schema.

Example:

{ "name": "address", "description": "The address of the individual.", "type": "object", "isRequired": true, "children": [ { "name": "street", "description": "The street address.", "type": "string", "isRequired": true }, { "name": "city", "description": "The city.", "type": "string", "isRequired": true }, { "name": "state", "description": "The state.", "type": "string", "isRequired": true }, { "name": "zip", "description": "The zip code.", "type": "string", "isRequired": true } ] }

Utilizing JSON Schema

Once you have defined your JSON schema, you can use it to extract and format your unstructured data. To do this, either you can use the Inolio's Playground or the Inolio API.