2.5.1.2 JSON Data Mapping

The different Oracle Tuxedo buffer types are converted into/from JSON as shown in the table below:

Table 2-13 JSON Data Mapping

Oracle Tuxedo Buffer Type JSON equivalent/example Notes
STRING <buffer content> -
CARRAY <binary buffer content> -
MBSTRING <Multi-byte string> In order to transmit encodings other than UTF-8, the "enableMultiEncoding" property must be set to "true" in the SALTDEPLOY configuration.
XML <XML fragment as-is> In order to transmit encodings other than UTF-8, the "enableMultiEncoding" property must be set to "true" in the SALTDEPLOY configuration.
X_C_TYPE Same as VIEW/VIEW32 -
X_COMMON Same as VIEW/VIEW32 -
X_OCTET Same as CARRAY -
VIEW/VIEW32 {'<fieldname>':'<fieldcontent>', '<fieldname>':'<fieldcontent>'}

possibly nested

{'<fieldname>':{'<fieldname>':'<fieldcontent>'}}

JSON has the following primitive types:
  • boolean (true/false)
  • Number (int or double float)
  • String

VIEW/VIEW32 field types are mapped as follows (Oracle Tuxedo type: JSON type):

See VIEW/VIEW32 considerations and examples for fieldname mapping details.

Some types may be truncated if represented in their primitive types (long long, long double), in that case they are rendered as JSON strings.

-
  • short: Number
  • int: Number
  • long: Number
  • float: Number
  • double: Number
  • char: String
  • string: String
  • carray: String (base64 encoded)
  • bool: boolean
  • unsigned char: String
  • signed char: String
  • wchar_t* or wchar_t: String
  • unsigned int: Number
  • unsigned long: Number
  • long long: String (See notes below table)
  • unsigned long long: String (See notes)
  • long double: String (See notes below table)
  • mbstring: String
  • view32: nested JSON record
-
FML/FML32 {'<fieldname>':'<fieldcontent>', '<fieldname>':'<fieldcontent>'}

possibly nested, FML32 only:

{'<fieldname>':{'<fieldname>':'<fieldcontent>'}}

FML/FML32 field types are mapped as follows (Oracle Tuxedo type: JSON type):

  • FLD_SHORT: Number
  • FLD_LONG: Number
  • FLD_FLOAT: Number
  • FLD_DOUBLE: Number
  • FLD_CHAR: String or character 'T' for JSON true or 'F' for JSON false
  • FLD_STRING: String
  • FLD_CARRRAY: String (base64 encoded)
  • FLD_MBSTRING: String
  • FLD_VIEW32: JSON nested record, see VIEW/VIEW32 mapping for individual types
  • FLD_FML32: JSON object

Nested FLD_VIEW32: the name of the view subtype must be the name of the embedded VIEW32.

For Example:

VIEW32 example.v definition file:

VIEW v32example

char flag1 - 1 - - -

string str - 1 100 - -

JSON content (EVIEW32 is a FLD_VIEW32 fml32 type):

{"EVIEW32" :

{"v32example":

{"flag1":"x",

"str":"somestring"}

}

}

RECORD {'<fieldname>':'<fieldcontent>', '<fieldname>':'<fieldcontent>'}

possibly nested

{'<fieldname>':{'<fieldname>':'<fieldcontent>'}}

Generated COBOL field types will be mapped as follows (Tuxedo type: JSON type):

Generated COBOL types:

  • RECORD: nested JSON record
  • COMP-1: Number
  • COMP-2: Number
  • S9(18): Number
  • 9(18): Number
  • S9(9): Number
  • 9(9): Number
  • S9(4): Number
  • S9(10)V9(10)COMP-3L: Number
  • X(1024): String
  • @binary=true: String
-

Note:

Non-structured buffer types (STRING, CARRAY, X_OCTET and MBSTRING) will not wrap data as JSON objects, the data is transmitted as is.

JSON internally handles all floating point types differently than XML. XML conversion floating point conversion may incur some precision loss over similar JSON conversions. This is currently a limitation.