JSON markup

JSON is an open standard format widely used in software development and web. Aspose.OMR for C++ allows you to use it to describe the content and layout of forms.

While JSON notation is not as compact as the text markup, but it is much easier to read and edit, especially when it comes to complex nested layouts. It supports syntax highlighting, automatic formatting, and code folding in all popular code editors.

According to the The JavaScript Object Notation (JSON) Data Interchange Format specification, it is highly recommended to use UTF-8 encoding without BOM (byte order mark).

Core concepts of JSON notation

JSON stands for JavaScript Object Notation. As the name suggest, its syntax is similar to the code for creating JavaScript objects:

  • Data is provided in form of name / value pairs (properties) separated by commas.
    The name must be enclosed in double quotes. The value can be one of the following data types:
    • string,
    • number / integer,
    • Boolean,
    • object,
    • array,
    • null.
  • An object is the collection of properties enclosed in curly braces. Objects can be nested inside other objects.
  • An array is a comma-separated set of values enclosed in curly braces.
  • The top-level object declaration is written as curly brackets that enclose other content.
{
	"element": {
		"name": "value",
		"array": [1, 2, 3],
		"nesting": {
			"name": "Nested object"
		}
	},
	"is_json": true
}

Aspose.OMR template structure

The top-level element of the Aspose.OMR for C++ source code must always be an object with the following structure:

{
	"element_type": "Template",
	"children": [
		{
			"element_type": "Page",
			"children": [
				/*** put content elements here */
			]
		}
	]
}

Content elements are provided as objects with the following set of properties:

  • Type of the element is specified in the value of element_type property (required).
  • Element attributes are provided as properties with the corresponding names.
  • Nested elements (if any) are passed as objects in the children array.
"element_type": "Container"
"children": [
	{
		"element_type": "Block",
		"children": [
			{
				"element_type": "Content",
				"name": "Getting started with JSON markup"
			}
		]
	}
]

Elements

Aspose.OMR for C++ offers a wide range of elements that allow you to create forms of any complexity - from a simple ballot to high school exam papers and finance application checklists.

  • Layout
    Arrange other elements; define the appearance and design of OMR forms.
  • Questionnaires
    Build OMR-ready surveys, ballots, checklists, and similar forms.
  • Answer sheets
    Populate a form with a grid of bubbles representing answers to an exam, test, or assessment.
  • Barcodes and QR codes
    Add barcodes and QR-codes to personalize or uniquely identify a form.
  • Write-ins
    Provide a blank field in which the respondent can hand write some text or draw a picture.

Examples

Check out code examples to see how different elements can be used and combined with each other.