The text of a CSPro
templated report (
Report) is represented as a
JSON string that is serialized according to the JSON serialization rules for
string values. The value is a string while the report is being created, and null otherwise.
When converting a JSON value to a
Report, an exception occurs if the value is not a valid string, or if the templated report is not in the process of creation.
The JSON for a
Report named
INT_INVEST_REPORT retrieved using
Report.getJson may look similar to:
{
"name": "INT_INVEST_REPORT",
"type": "Report",
"template": {
"name": "international-investment.html",
"encoding": "HTML",
"path": "C:/surveys/reports/international-investment.html",
"extension": "html",
"contentType": "text/html"
},
"value": null
}
The
Report's value will generally be null, but if converting the object to JSON while the Report's
text template is being generated, the value will reflect the text processed up to the point of the function call. For example, given the following templated report, written in Markdown:
The evaluated report will appear with the values represented as JSON strings encoded for Markdown:
Pre-title text!
# Report Title
"Pre\-title text\!\\n\\n\# Report Title\\n\\n"
Some **important** content!
"Pre\-title text\!\\n\\n\# Report Title\\n\\n\\"Pre\\\\\-title text\\\\\!\\\\\\\\n\\\\\\\\n\\\\\# Report Title\\\\\\\\n\\\\\\\\n\\"\\n\\nSome \*\*important\*\* content\!\\n\\n"