Altova XMLSpy 2024 Enterprise Edition

There are five JSON atomic (aka simple or primitive) types: (i) string, (ii) number, (iii) integer, (iv) boolean, and (v) null. To specify that a definition is one of these atomic types, do one of the following:

 

Double-click the Type value field in the definition's box, and select the type

In the Details entry helper, select the type from the dropdown list in the Type field.

 

The constraints of each atomic type are described below.

 

String

For the string type, you can specify the following constraints: (i) length of the string, (ii) a regular expression that describes the pattern of the string, (iii) a predefined format from the specification.

JSONConstraintsString
Note:In the JSON Validation settings of XMLSpy, you can specify whether the format of strings in JSON instance documents must be validated or not.

 

Numeric

The numeric type is a collective name for two types (number and integer; see screenshot below). The actual type is set in the Mode field (the default of which is number). The difference between the two types is that the number type allows decimals, whereas the integer type does not. If a value exists in the MultipleOf field, then the instance value must be an integer multiple of the MultipleOf value.

JSONConstraintsNumeric

Valid values for the number type defined in the screenshot above are: 5.94, 6.93, 7.92, and 8.91.

 

Boolean and Null

The boolean type takes either true or false as its values. The null type takes null as its value. Neither type takes any constraint.

 

© 2017-2023 Altova GmbH