JSON File

 

 

 

JSON File

 

The JSON File source connection allows for the import of data stored in JavaScript Object Notation (JSON) files.  The connection designer is capable of converting a JSON document into an XML document and inferring the structure if no schema definition files exist.  The connection uses the inferred or static schema definitions to build a hierarchy of the source document which is presented in the user interface as a tree structure that can be used to drag-and-drop visual elements from the tree on key areas of the user interface to write macro commands to process the source data.

 

XML Primer


This connection makes use of XML, XSD, and XPATH technology as documented here.


 

JSON Data Source Page

 

In order to map the JSON file, the file must first be represented as an XML document.  In order to guarantee the document can be represented as well-formed XML, the JSON data must be assigned a root element name and an object name in order to address situations where a JSON document is represented as a nameless collection at the top level.  Additionally, field names that are illegal XML tag names are properly escaped when generating the XML document.

 

Deserialization Root Element Name:  The name of the root element assigned to the XML representation of the JSON file.

Deserialization Object Name: The name of the element that will contain the JSON file represented as XML.

 

JSON Schema Definition Page


This connection uses the XML Schema Definition common import UI as documented here.


 

JSON Mapping Page

 

The JSON Mapping Page will display the structure of the XML document based on setting on the JSON Schema Definition page and allow elements and attributes to be mapped to an incoming line.  Clicking and dragging a node from the tree will dynamically create XPath macro commands.

 

General Tab

 

The General tab is used to define the base element path and specify relative XPath macro commands for mapping fields commonly used by the wizard.

 

Base Element XPath:  This is the XPath expression that specifies selection criteria for the document elements that represents an account line.  These will typically be a repeating element within the XML document.  This field is required to be filled in first if using drag and drop to generate XPath macros for the remaining fields as they will be written automatically by the program relative to this expression path.  While this field is macro enabled for those that want more control over the process the XPath macro command cannot be used in this field - only XPath expressions.

Vendor Code:  The vendor code for the vendor.  This is a macro-enabled field.

Vendor Name:  The name of the vendor.  This is a macro-enabled field.

Description:  The description of the vendor.  This is a macro-enabled field.

Active:  The active status of the vendor, typically a true/false or boolean (1/0) value.  This is a macro-enabled field.

Status:  The actual status of the vendor.  This is a macro-enabled field.

Site/Property:  The site or property of the vendor.  This is a macro-enabled field.

Email Address:  The email address of the vendor.  This is a macro-enabled field.

Web Site URL:  The website of the vendor.  This is a macro-enabled field.

Currency:  The currency of the vendor.  This is a macro-enabled field.

Payment Terms:  The payment terms of the vendor.  This is a macro-enabled field.

Tax ID:  The tax ID of the vendor.  This is a macro-enabled field.

 

Address Tab

 

The Address tab will allow you to specify multiple addresses for the vendor. 

 

Recursion XPath: This is an optional value used to specify an XPath expression used to establish a path relative to the Base Element XPath used to select the elements that contain zero, one, or more phone numbers.  When this option is used the remaining fields should both be XPath macro expressions.

Address Type: Optional XPath macro expression for naming the type of address being imported from the document.  This is typically hard-coded unless a Recursion XPath is provided in which case it is a XPath macro expression.

Line 1: XPath macro expression for extracting the first address line from the document.

Line 2: Optional XPath macro expression for extracting the second address line from the document.

Line 3: Optional XPath macro expression for extracting the third address line from the document.

City: Optional XPath macro expression for extracting the city from the document.

Region/State: Optional XPath macro expression for extracting the state (or region) from the document.

Postal Code: Optional XPath macro expression for extracting the postal code from the document.

Country: Optional XPath macro expression for extracting the country from the document.

 

Phone Tab

 

The Phone tab will allow you to specify multiple phone numbers for the vendor.

 

Recursion XPath: This is an optional value used to specify an XPath expression used to establish a path relative to the Base Element XPath used to select the elements that contain zero, one, or more phone numbers.  When this option is used the remaining fields should both be XPath macro expressions.

Phone Type: Optional XPath macro expression for naming the type of phone number being imported from the document.  This is typically hard-coded unless a Recursion XPath is provided in which case it is a XPath macro expression.

Number: XPath macro expression for extracting the phone number from the document.

Extension: Optional XPath macro expression for extracting the phone extension from the document.

 

Attributes Tab

 

XML tags from any location in the hierarchy can be made into imported from the source data. Drag and drop of tags from the hierarchical document tree onto any control with a yellow background will automatically write XPath macro commands

 

Recursion XPath: This is an optional value used to specify an XPath expression used to establish a path relative to the Base Element XPath used to select the elements that contain zero, one, or more attribute name/value pairs.  When this option is used the Attribute Name Macro and Attribute Value Command should both be XPath macro expressions.

Attribute Name Macro: This is a name or macro expression used to name the source attribute during import.  When a Recursion XPath is specified this should be a XPath macro command.  When recursion is not used this is likely to be a hard-coded name.

Attribute Value Macro: This is a macro command that extracts the value from the XML document to populate the imported attribute named by the Attribute Name Macro field.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.