converter.jar
The converter.jar utility converts REST call output files from compact MDC (CMDC) to compact XML files, compact XML to compact MATRIXX Data Container (MDC) files, or compact XML or MDC files to JSON files.
Note: Custom MDCs are defined in the
/opt/mtx/conf/mdc_config_custom.xml file.
Syntax
java -jar converter.jar [-h] [-v] {-in:xml | -in:mdc} [-json] filename
Where filename
is the file to be converted.
Options
- -help
- Returns information about the script.
- -v, --verbose
- Runs the script in verbose mode and returns more details as standard output.
- -json
- Converts the input file to JSON output.
- -in:xml
- Converts compact XML input files to compact MDC output. The command produces compact MDC files with the input file names with the extension .mdc appended to them. You must specify this option if the file extension of the input file does not indicate that it is compact XML (.xml) or if the input is standard input.
- -in:mdc
- Converts compact MDC input files to compact XML output. The command produces compact XML files with the input file names with the extension .xml appended to them. You must specify this option if the file extension of the input file does not indicate that it is compact MDC (.mdc) or if the input is standard input.
- -out:file
- Creates an output file with an .xml or .mdc extension.
- -out:stdout
- Output is written to stdout.
Convert to JSON
java -jar /opt/mtx/bin/converter.jar -json ./path/inEvents100KSubs100K.txt
...
{
"$": "MtxDiamRoMsg",
"CalledStationId": "14086761110",
"CallingStationId": "14085651100",
"CallingTowerId": 32,
"ContentType": 1,
"DeviceId": "term_a",
"EventTime": "2009-12-24T07:45:00.000000",
"ExternalServiceType": 3,
"MultiServiceList": [
{
"$": "MtxMultiServiceData",
"ServiceId": 3,
"UsedQuantityList": [
{
"$": "MtxUsedQuantityData",
"ActualDurationQuantity": 86700.0,
"DurationUnit": 100
}
]
}
],
"NetworkId": 789,
"NormalizedSessionId": 100000,
"Op": 1,
"ServiceTypeObjectId": 3,
"SessionId": "100000",
"SessionMsgId": 1
}