JSON5 is a proposed extension to JSON that aims to make it easier for people to write JSON files by hand. Importantly, JSON5 is not an official successor to JSON (for more information, see https://json5.org/).
JSON5 files use the .json5 extension; however, at the time when this documentation is written, there is no official MIME type for .json5 files. The .json5 extension is nevertheless recognized by MapForce when you add such files to the mapping. If you deploy the mapping to FlowForce Server (see Deploying Mappings to FlowForce Server), the MIME type of .json5 files will be reported as "application/json5".
|•||In order to map data to or from JSON5 files, a valid JSON schema (which should not use JSON5 syntax) must be supplied to MapForce. If you don't have a JSON schema for your file, MapForce will generate it automatically, as shown below. The schema generated automatically by MapForce will be a JSON (not a JSON5) schema. It is also possible to generate a JSON schema for a .json5 file with XMLSpy.|
|•||Mapping comments to or from .json5 files is not supported.|
|•||Because MapForce works with strict data types, it is not possible to qualify and map values such as Infinity, -Infinity, NaN, or -NaN.|
How to map data to or from .json5 files
|1.||On the Insert menu, click JSON, and browse for the .json5 instance file (Alternatively, click the toolbar button). If you have a JSON schema file and prefer to supply the .json5 instance file later, browse for a valid JSON (not a JSON5) schema. This works in the same way as with plain JSON files (see Adding JSON Files as Mapping Components).|
|2.||After the JSON component has been added to the mapping, right-click its header, select Properties, and then select the Use JSON5 check box from component properties (see also JSON Component Settings). This explicitly instructs MapForce to treat the instance data as such.|
To generate a JSON5 file with MapForce, select the Use JSON5 check box as shown above, and connect the required input data to the JSON component on the mapping. When the Use JSON5 check box is selected, MapForce will not surround the object keys by quotes, except where this would make the generated JSON5 instance invalid. The desired file extension (for example, "json5") can also be controlled from the dialog box illustrated above, by entering the appropriate value in the Output JSON File field.
© 2019 Altova GmbH