SourceID Processing Instructions in Generic JSON

"[?SourceID?]" instructions must be placed inside repeated scope and are used in conjunction with a "[?Repeated?]" processing instruction.

  • Only one "[?SourceID?]" is allowed for each repeated scope.

  • "[?SourceID?]" is used to extract the identifier for a repeated element when the identifier is a value in a JSON object.

The following is an example of an input document that requires the repeated instruction and ID source declarations to happen on different objects:

Copy
{
  "Products": [
    {
  "ID": "EXA-5002-1004",
  "Attributes": [
    {
  "AttributeID": "52",
  "Value": "Some description text"
},
{
  "AttributeID": "77",
  "Value": "53 kg"
}  
  ]
}
  ]
}   

The following is a Generic JSON template for processing the input document:

Copy
{
  "Products": [
    {
  "[?Instruction?]": "[?Record?]",
  "ID": "[?Source ID?]",
  "Attributes": [
    {
  "[?Instruction?]": "[?Repeated?]",
  "AttributeID": "[?SourceID?]",
  "Value": "[?Source?]"
}
  ]
}
  ]
}  

When used on the input document, this template outputs the fields 'ID', '52.Value', '77.Value'. In this case, the subtree from 'Value' and down is said to be in repeated scope.

Follow the steps and use the following template to extract the input document:

  1. Copy the above Generic JSON input to a new file and save as a JSON file.
  2. Open Import Manager, select the file as the Data Source Filename, and click 'Next.'
  3. Enter or paste the template below in the Import Manager, and generate a conversion preview by clicking the refresh button, .
Copy
{
  "Products": [
    {
  "[?Instruction?]": "[?Record?]",
  "ID": "[?Source ID?]",
  "Attributes": [
    {
  "[?Instruction?]": "[?Repeated?]",
  "AttributeID": "[?SourceID?]",
  "Value": "[?Source?]"
}
  ]
}
  ]
}  

For the input document, this template generates the fields ID, 52.Value and 77.Value.