C and C++ to JSON Schema mapping
The JSON web services assistant with parameters MAPPING-MODE=LS2JS
and LANG=C
or LANG=CPP
will
map between C or C++ data types and JSON Schema definitions.
C and C++ names are converted to JSON names according to
the following rules:
- Characters that are not valid in JSON property names are replaced
with '
X
'.For example,
monthly-total
becomesmonthlyXtotal
. - Duplicate names are made unique by the addition of one or more
numeric digits.
For example, two instances of
year
becomeyear
andyear1
.
JSON web
services assistant maps C and C++ data types to schema elements
according to the following table. C and C++ types that are not shown
in the table are not supported by JSON web services assistant. The
_Packed
qualifier
is supported for structures. These restrictions apply:- Header files must contain a top level
struct
instance. - You cannot declare a structure type that contains itself as a member.
- The following C and C++ data types are not supported:
decimal
long double
wchar_t
(C++ only)
- The following are ignored if they are present in the
header file.
- Storage class specifiers:
auto
register
static
extern
mutable
- Qualifiers
const
volatile
_Export
(C++ only)
- Function specifiers
inline
(C++ only)virtual
(C++ only)
- Initial values
- The header file must not contain these items:
- Unions
- Class declarations
- Enumeration data types
- Pointer type variables
- Template declarations
- Predefined macros; that is, macros with names that start and
end with two underscore characters (
__
) - The line continuation sequence (a \ symbol that is immediately followed by a newline character)
- Prototype function declarators
- Preprocessor directives
- Bit fields
- The
__cdecl
(or_cdecl)
keyword (C++ only)
- The application programmer must use a 32-bit compiler to ensure
that an
int
maps to 4 bytes. - The following C++ reserved keywords are not supported:
explicit
using
namespace
typename
typeid
C and C++ data type | Schema simpleType |
---|---|
char[z] |
|
char16_t[n] |
At run time, CICS® TG populates the application data structure field with UTF-16 data. |
char[8] Supported when |
The format of the timestamp is defined
by RFC3339. |
char short int long long long |
where n is the maximum value that can
be represented by the primitive. |
unsigned char unsigned short unsigned int unsigned long unsigned long long |
where n is the maximum value that can
be represented by the primitive. |
(C++ only) |
|
|
Note: The IBM® Hexadecimal Floating Point (HFP)
data representation is not exactly the same as the IEEE-754-1985 representation
used for JSON. Some values may not convert exactly from one representation
to the other. Some extremely large or small values might not be valid
for float data types. Some values may lose precision when converted
to or from HFP representation. If precise conversions are important,
consider replacing use of float data types with fixed precision alternatives.
|
|
Note: The IBM Hexadecimal Floating Point (HFP)
data representation is not exactly the same as the IEEE-754-1985 representation
used for JSON. Some values may not convert exactly from one representation
to the other. Some extremely large or small values might not be valid
for double data types. Some values may lose precision when converted
to or from HFP representation. If precise conversions are important,
consider replacing use of double data types with fixed precision alternatives.
|
type name[n] | For primitives: For structs: Where type JSON is the JSON Schema
representation of the C or C++ type. |