JSON Parsing Parameters

The parameters in this section configure how CFS parses JSON.

For example, consider the following JSON:

{
    "DREREFERENCE": "reference",
    "FIELDS": [{
            "NAME": "myFirstField",
            "VALUE": "myFirstFieldValue"
        }, {
            "NAME": "mySecondField",
            "FIELDS": [{
                    "NAME": "mySubFieldName",
                    "VALUE": "mySubFieldValue",
                    "ATTRIBUTES": [{
                          "NAME": "attribute",
                          "VALUE": "attributeValue"
                        }
                    ]
                }
            ]
        }
    ],
    "DRECONTENT": ["document content"]
}

The following configuration parses the JSON into documents. This configuration extracts fields and sub-fields recursively, because the FieldSections parameter refers to the name of the section in which it is set:

[JSONParsing]
ReferencePath=DREREFERENCE
ContentPaths=DRECONTENT
ExpandArrays=true
FieldSections=Field

[Field]
Path=FIELDS
NamePath=NAME
ValuePath=VALUE
ExpandArrays=true
FieldSections=Field
AttributeSections=Attribute

[Attribute]
Path=ATTRIBUTES
NamePath=NAME
ValuePath=VALUE
ExpandArrays=true

CFS produces the following document:

#DREREFERENCE reference
#DREFIELD myFirstField="myFirstFieldValue"
#DREFIELD mySecondField/mySubFieldName="mySubFieldValue"
#DREFIELD mySecondField/mySubFieldName/@attribute="attributeValue"
#DRECONTENT
document content
#DREENDDOC