How to Create a JSON Import Integration
This guide walks you through creating and configuring an integration to import JSON (JavaScript Object Notation) files into Business Central.
Prerequisites
- Permission - You have NAVX IF STANDARD or NAVX IF ALL permission set
- JSON File - You have a JSON file (.json) with data to import
- Target Table - You know which Business Central table will receive the data
What is JSON Import
JSON is a lightweight, text-based data format widely used in modern data exchange. The Integration Framework supports importing JSON files, allowing you to bring data from APIs, web services, and other systems directly into Business Central without manual conversion.
When to Use JSON Import
JSON import is the right choice when:
- API Responses - You receive data from REST APIs or web services in JSON format
- Modern Data Exchange - Your trading partners or internal systems export data as JSON
- Nested Data Structures - Your source data contains hierarchical or nested objects that would be difficult to represent in flat CSV or Excel files
- Web Application Data - You need to import data exported from web-based applications
- Configuration Data - You need to import structured configuration or reference data
JSON Structure Overview
JSON files can contain different structures. The Integration Framework handles three common patterns:
Flat Arrays
A simple list of objects with no nesting:
[
{ "code": "CUST001", "name": "Contoso Inc", "phone": "555-0100" },
{ "code": "CUST002", "name": "Northwind Traders", "phone": "555-0101" }
]
Nested Objects
Objects containing child objects with additional detail:
[
{
"orderNo": "SO-1001",
"customer": {
"name": "Contoso Inc",
"address": {
"city": "Seattle",
"state": "WA"
}
},
"amount": 1500.00
}
]
Arrays Within Objects
Objects containing child arrays (e.g., order lines within an order):
{
"data": {
"invoices": [
{
"invoiceNo": "INV-001",
"customer": "Contoso Inc",
"lines": [
{ "item": "WIDGET-A", "qty": 10, "price": 25.00 },
{ "item": "WIDGET-B", "qty": 5, "price": 50.00 }
]
}
]
}
}
Step-by-Step Process
Step 1: Create a New Integration
- Navigate to Integration Framework > Integrations
- Click New
- Complete the following fields:
- Code - Unique identifier (e.g., "ORDER_JSON_IMPORT")
- Description - Clear name (e.g., "Sales Orders from JSON")
- Integration Type - Select Json
- Direction - Select Import
Step 2: Upload a JSON Sample File
- On the Integration, click Upload JSON Sample
- Select a representative JSON file that contains the structure you expect to import
- The system stores the sample for field discovery and path validation
The sample file does not need to contain all possible data, but it should reflect the full structure of the JSON you will import, including any nested objects and arrays.
Step 3: Set JSON Root Path
If your data array is nested inside a wrapper object, you must specify the path to the root array.
- On the Integration, set the JSON Root Path field
- Use dot-notation to specify the path to the array of records
Examples:
| JSON Structure | JSON Root Path |
|---|---|
Top-level array [ {...}, {...} ] |
(leave blank) |
{ "data": [ {...}, {...} ] } |
data |
{ "data": { "invoices": [ {...} ] } } |
data.invoices |
{ "response": { "body": { "records": [ {...} ] } } } |
response.body.records |
Step 4: Set JSON Array Path for Child Arrays
If your JSON objects contain child arrays that you want to flatten into individual rows, set the JSON Array Path.
- On the Integration, set the JSON Array Path field
- Enter the property name of the child array within each record
Example: For an order with line items, set JSON Array Path to lines. This tells the system to expand each line item into its own row, duplicating the parent order values.
Step 5: Discover Fields from Sample
- From the Integration, click Suggest Fields from Sample
- The system analyzes the uploaded JSON sample and creates integration fields automatically
- Review the suggested fields on the Integration Fields page
- Remove any fields you do not need
- Add any constant fields required for your mapping
Step 6: Map Fields to Business Central
From the Integration, click Integration Mappings
For each field, create a mapping:
- Source Field - Select the source field from Step 5
- Destination Table - Select target table (e.g., "Customer")
- Destination Field - Select BC field that receives the data
- Validate - Enable to validate field values during import
Optional - For lookups (e.g., matching code values):
- Get Value From Lookup - Enable
- Lookup Table - Select lookup table
- Lookup Field - Select field to match against
- Return Field - Select field value to use
Step 7: Import and Review Data
- Click Import on the Integrations list
- Select your JSON file (.json)
- System parses JSON based on configured root path and array path
- Review the imported records on the Integration Records page
Step 8: Process Data into Business Central
- Select records to process (or all records)
- Click Process or Process All
- Records move to Completed or Error status
- If errors exist, click Show Errors to view details
JSON Path Configuration
The Integration Framework uses dot-notation paths to reference values within JSON objects. Each integration field has a JSON Path property that specifies where to find the value in the JSON structure.
Path Examples
| JSON Path | Description | Example Value |
|---|---|---|
name |
Simple top-level property | "Contoso Inc" |
email |
Simple top-level property | "info@contoso.com" |
customer.name |
Nested object property | "Contoso Inc" |
address.city |
Nested object property | "Seattle" |
order.customer.address.city |
Deep nested property | "Seattle" |
lines.item |
Property within child array element | "WIDGET-A" |
Setting JSON Path on Integration Fields
- Navigate to Integration Fields from the Integration
- For each field, the JSON Path column shows the dot-notation path
- When fields are suggested from sample, paths are set automatically
- You can manually edit the path if needed
JSON Path Lookup Page
To discover available paths from your sample file:
- From the Integration Fields page, use the JSON Path Lookup page
- The page displays all available paths found in the uploaded JSON sample
- Select a path to assign it to a field
- This is useful when your JSON structure is complex or deeply nested
JSON Array Handling
When your JSON contains child arrays (e.g., line items within an order), you can control how those arrays are processed. Three modes are available:
Flatten
Expand each child array element into its own row. Parent-level values are duplicated for each child row.
Input:
{
"orderNo": "SO-1001",
"customer": "Contoso Inc",
"lines": [
{ "item": "WIDGET-A", "qty": 10 },
{ "item": "WIDGET-B", "qty": 5 }
]
}
Result (2 rows):
| orderNo | customer | item | qty |
|---|---|---|---|
| SO-1001 | Contoso Inc | WIDGET-A | 10 |
| SO-1001 | Contoso Inc | WIDGET-B | 5 |
Use Flatten when you need to create individual records for each child element (e.g., sales order lines).
Concatenate
Join all child array values into a single string with a separator.
Result (1 row):
| orderNo | customer | items |
|---|---|---|
| SO-1001 | Contoso Inc | WIDGET-A, WIDGET-B |
Use Concatenate when you need a summary of child values in a single field.
First
Take only the first element from the child array.
Result (1 row):
| orderNo | customer | item | qty |
|---|---|---|---|
| SO-1001 | Contoso Inc | WIDGET-A | 10 |
Use First when you only need the primary or first child element.
Field Mapping for JSON
JSON field mapping follows the same principles as other integration types, with these JSON-specific considerations:
- Automatic Discovery - Use "Suggest Fields from Sample" to create fields automatically from your JSON sample
- Nested Values - Fields from nested objects are accessible via dot-notation paths
- Data Types - JSON natively supports strings, numbers, booleans, and null values; the framework converts these to appropriate Business Central data types
- Constant Fields - Use Column Type Constant for values not present in the JSON (e.g., a fixed document type or posting group)
JSON Validation
Before processing, the system performs validation checks specific to JSON imports:
- Valid JSON - The file must contain valid JSON syntax
- Root Path Exists - If a JSON Root Path is configured, the specified path must exist in the file
- Array Expected - The root path (or top level if blank) must resolve to an array of objects
- Required Fields - All mapped required fields must have values in each record
- Data Type Compatibility - JSON values must be compatible with the target Business Central field types
- Path Resolution - All configured JSON paths must resolve to values in the imported data
Common Scenarios
Scenario 1: Flat JSON Array (Customer List)
JSON file (customers.json):
[
{ "code": "CUST001", "name": "Contoso Inc", "phone": "555-0100", "city": "Seattle" },
{ "code": "CUST002", "name": "Northwind Traders", "phone": "555-0101", "city": "Chicago" },
{ "code": "CUST003", "name": "Fabrikam Inc", "phone": "555-0102", "city": "Dallas" }
]
Configuration:
Integration Type: Json
JSON Root Path: (blank)
JSON Array Path: (blank)
Source Fields:
- Field 1: "Customer Code" (JSON Path: code)
- Field 2: "Customer Name" (JSON Path: name)
- Field 3: "Phone" (JSON Path: phone)
- Field 4: "City" (JSON Path: city)
Mappings:
- "Customer Code" -> Customer.No.
- "Customer Name" -> Customer.Name
- "Phone" -> Customer."Phone No."
- "City" -> Customer.City
Scenario 2: Nested Objects (Orders with Customer Details)
JSON file (orders.json):
{
"data": {
"orders": [
{
"orderNo": "SO-1001",
"orderDate": "2026-03-01",
"customer": {
"code": "CUST001",
"name": "Contoso Inc"
},
"totalAmount": 1500.00
},
{
"orderNo": "SO-1002",
"orderDate": "2026-03-02",
"customer": {
"code": "CUST002",
"name": "Northwind Traders"
},
"totalAmount": 2300.00
}
]
}
}
Configuration:
Integration Type: Json
JSON Root Path: data.orders
JSON Array Path: (blank)
Source Fields:
- Field 1: "Order No." (JSON Path: orderNo)
- Field 2: "Order Date" (JSON Path: orderDate)
- Field 3: "Customer Code" (JSON Path: customer.code)
- Field 4: "Customer Name" (JSON Path: customer.name)
- Field 5: "Total Amount" (JSON Path: totalAmount)
Mappings:
- "Order No." -> Sales Header."No."
- "Order Date" -> Sales Header."Order Date"
- "Customer Code" -> Sales Header."Sell-to Customer No."
- "Customer Name" -> Sales Header."Sell-to Customer Name"
- "Total Amount" -> (validation only)
Scenario 3: Nested Arrays (Orders with Line Items using Flatten)
JSON file (order_lines.json):
{
"orders": [
{
"orderNo": "SO-1001",
"customer": "CUST001",
"lines": [
{ "itemNo": "ITEM-A", "quantity": 10, "unitPrice": 25.00 },
{ "itemNo": "ITEM-B", "quantity": 5, "unitPrice": 50.00 }
]
},
{
"orderNo": "SO-1002",
"customer": "CUST002",
"lines": [
{ "itemNo": "ITEM-C", "quantity": 20, "unitPrice": 15.00 }
]
}
]
}
Configuration:
Integration Type: Json
JSON Root Path: orders
JSON Array Path: lines
Array Handling: Flatten
Source Fields:
- Field 1: "Order No." (JSON Path: orderNo)
- Field 2: "Customer" (JSON Path: customer)
- Field 3: "Item No." (JSON Path: lines.itemNo)
- Field 4: "Quantity" (JSON Path: lines.quantity)
- Field 5: "Unit Price" (JSON Path: lines.unitPrice)
Result after flattening (3 rows):
Row 1: SO-1001, CUST001, ITEM-A, 10, 25.00
Row 2: SO-1001, CUST001, ITEM-B, 5, 50.00
Row 3: SO-1002, CUST002, ITEM-C, 20, 15.00
Mappings:
- "Order No." -> Sales Line."Document No."
- "Customer" -> Sales Line."Sell-to Customer No."
- "Item No." -> Sales Line."No."
- "Quantity" -> Sales Line.Quantity
- "Unit Price" -> Sales Line."Unit Price"
Troubleshooting
Issue: "Invalid JSON" error on import
- Cause - The file contains malformed JSON syntax (missing brackets, trailing commas, unquoted keys)
- Solution - Validate your JSON file using a JSON validator before importing
- Check - Open the file in a text editor and verify proper JSON formatting
Issue: "Root path not found" error
- Cause - The JSON Root Path does not match the actual structure of the file
- Solution - Verify the JSON Root Path matches your file structure exactly (case-sensitive)
- Check - Open the JSON file and trace the path from the root to your data array
Issue: "No records found" after import
- Cause - The root path resolves to an empty array or the path is incorrect
- Solution - Verify the JSON Root Path points to an array containing objects
- Verify - Upload a new JSON sample and use JSON Path Lookup to confirm available paths
Issue: Fields importing as blank
- Cause - JSON Path on the integration field does not match the property name in the file
- Solution - Check that JSON Path values are case-sensitive and match the JSON property names exactly
- Debug - Use the JSON Path Lookup page to verify correct paths from your sample
Issue: Nested array data missing or duplicated
- Cause - JSON Array Path is not set or is set incorrectly
- Solution - Set the JSON Array Path to the exact property name of the child array (e.g.,
lines) - Verify - Confirm the array handling mode (Flatten, Concatenate, First) matches your requirements
Issue: Date or number format errors
- Cause - JSON values are in a format that Business Central cannot parse
- Solution - Ensure dates are in ISO 8601 format (YYYY-MM-DD) and numbers use dot as decimal separator
- Check - Verify JSON values are proper JSON types (numbers without quotes, dates as strings)
Best Practices
- Upload a Representative Sample - Include all object types, nested structures, and array elements in your sample file so field discovery is complete
- Use Suggest Fields from Sample - Let the system auto-discover fields rather than creating them manually to avoid path errors
- Set Root Path Correctly - Verify the JSON Root Path before importing to avoid "path not found" errors
- Test with Small Files - Import a small JSON file first to verify paths and mappings before processing large datasets
- Validate JSON Before Import - Use a JSON validator to confirm file syntax before uploading
- Use Flatten for Line Items - When importing documents with line items (orders, invoices), use Flatten mode to create individual rows
- Enable Field Validation - Use validation in mappings to catch data errors early in the process
- Review Error Messages - Check error details on failed records before reprocessing
- Keep Paths Simple - Where possible, simplify your JSON structure before import to reduce deep nesting
- Document Your Paths - Maintain a reference of JSON paths and their corresponding Business Central fields for each integration