Altova XMLSpy 2024 Enterprise Edition

JSON Lines and JSON Comments

Home Prev Top Next

XMLSpy supports JSON Lines (JSONL) and JSON with Comments (JSONC) documents, meaning that validation and intelligent editing of these documents is available to the same extent that it is for other types of JSON documents. This section discusses key features of these types of JSON documents.

 

JSON Lines

JSON Lines (JSONL) is a format for storing structured data, where each record is separated from the next by a newline; that is, each record is on its own line. As a result, each record can be processed one at a time, which makes the format very useful when processing data such as log files.

 

Example JSON Lines document

["Team", "Played", "Won", "Drew", "Lost", "Points"]

["USA", 2, 1, 1, 0, 4]

["France", 3, 1, 1, 1, 4]

["Germany", 1, 0, 1, 0, 1]

["USA", 1, 0, 0, 1, 0]

 

For more examples, see http://jsonlines.org/examples/.

 

JSON Lines files are recognized as such in XMLSpy if the file has a .jsonl extension.

 

JSON with Comments

JSON documents other than JSON5 documents do not allow comments. The JSON with Comments format (JSONC) has been introduced to allow comments in JSON documents. The following comments are used in JSONC and supported in XMLSpy:

 

Single-line comments: Prefixed by //. For example: // My comment

Multi-line comments: Delimited by /* and */. For example: /* My comment */

 

JSONC files are recognized as such in XMLSpy if the file has a .jsonc extension.

 

Note:Comments are also allowed in JSON5 documents. Comments in other types of JSON files (besides JSONC and JSON5) could cause errors during processing.

 

© 2017-2023 Altova GmbH