3.13.1 JSON-XML transformation definition file
- Organization of this subsection
(1) Format
[json-xml-convert.arrays.parent-element-name=root-element-name-of-XML-format-data] [json-xml-convert.arrays.child-element-name=repeat-element-name-of-XML-format-data] [json-xml-convert.arrays.child-simple-element-name=child-element-name-defined-in-repeat-element-of-XML-format-data] [json-xml-convert.root-element-name=root-element-name-of-XML-format-data] [json-xml-convert.json-type.include={true|false}]
(2) Function
Specifies the operations related to transformation between JSON format data and XML format data. This file is specified as a self-defined file when HTTP reception and the HTTP adapter are created in the development environment.
This file is used by the JSON transformation tools (cscjson2xsd command and cscjsonxmlconv command). The file is not used by a JSON-XML transformation API. Note that you can also use this file in the execution environment. Use the same file in the development environment and execution environment so that the same execution results are obtained from the JSON transformation tools.
Edit and use the following template file.
- Location of the template file
service-platform-installation-directory\CSC\config\msg\templates\csc_json_converter.properties
To edit the JSON-XML transformation definition file to be used by the HTTP adapter or HTTP reception:
-
In the Service adapter definition window (detailed), click the Add button for Self-defined file and then add the template file of the JSON-XML transformation definition file.
-
Click the Edit button for Self-defined file.
The editor for editing the JSON-XML transformation definition file starts.
-
Edit the JSON-XML transformation definition file in the editor.
-
From the Eclipse menu, select File, and then Save to save the edited information.
The file name is fixed to csc_json_converter.properties. Any other file names specified for a self-defined file are invalid. If csc_json_converter.properties is not specified for the self-defined file, JSON-XML transformation is performed with the default settings.
To read the defined JSON-XML transformation definition file during transformation of JSON format data, you need to execute the cscjson2xsd command or cscjsonxmlconv command by using one of the following methods:
-
Execute the command with the JSON-XML transformation definition file name specified in the -f argument.
-
Store the JSON-XML transformation definition file in the following path in advance, and then execute the command without specifying the -f argument.
service-platform-installation-directory\CSCTE\config\tools\json\csc_json_converter.properties
With the file stored in this directory, when you execute the command with the -f argument specified, the JSON-XML transformation definition file specified in the -f argument will be applied.
For details about data transformation using a JSON transformation tool (cscjson2xsd command or cscjsonxmlconv command), see the manual Service Platform Basic Development Guide.
The specified settings are enabled when HTTP reception and the HTTP adapter start. If the definition is invalid, an error occurs during deployment or startup of HTTP reception and the HTTP adapter.
(3) Specifiable properties
json-xml-convert.arrays.parent-element-name=root-element-name-of-XML-format-data ~ <Character string of NCName type><<csc-array>>
Specify the name of the root element of XML format data that is generated if the JSON format data begins from an array.
json-xml-convert.arrays.child-element-name=repeat-element-name-of-XML-format-data ~ <Character string of NCName type><<csc-element>>
Specify the name of the repeat element of XML format data corresponding to the array of JSON format data.
json-xml-convert.arrays.child-simple-element-name=child-element-name-defined-in-repeat-element-of-XML-format-data ~<Character string of NCName type><<csc-simple>>
Specify the child element name defined in the repeat element of XML format data corresponding to the array value of string type, numeric type, or boolean type of JSON format data.
json-xml-convert.root-element-name=root-element-name-of-XML-format-data ~ <Character string of NCName type><<csc-object>>
Specify the name of the root element of XML format data that is generated if the JSON format data begins from the object type.
json-xml-convert.json-type.include={true|false} ~ <<false>>
Specify whether the JSON data type is to be included in the attributes of XML format data.
-
true
The data type of JSON format data is included in the attributes of XML format data.
-
false
The data type of JSON format data is not included in the attributes of XML format data.
(4) Example of coding
An example of coding is as follows.
json-xml-convert.arrays.parent-element-name=csc-array json-xml-convert.arrays.child-element-name=csc-element json-xml-convert.arrays.child-simple-element-name=csc-simple json-xml-convert.root-element-name=csc-object json-xml-convert.json-type.include=false