• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
        • Symbol.getName Function
        • Symbol.getLabel Function
        • Symbol.getJson Function
        • Symbol.getValueJson Function
        • Symbol.updateValueFromJson Function
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Symbol.getJson Function

Format
s = symbol_name.getJson(ʃserializationOptions := serialization_optionsʅ);
Description
The Symbol.getJson function returns the JSON representation of a symbol. The symbol's metadata is always returned, and when a symbol supports representing its value as JSON, the value is also returned. The optional serialization_options argument allows you to specify how the symbol should be serialized, potentially overriding the default application settings.
You can use the Symbol.getValueJson function if you only want to work with the symbol's value. You can also use the Logic.getSymbol action to get a symbol's metadata and value.
All symbols support the serialization of the symbol metadata. The following table describes the value-related serialization routines available for CSPro objects and contains links to the description of the JSON representation for each object.
Documentation about JSON representations feature will come in a future release. In the meantime you can see if the documentation is updated at:
https://www.csprousers.org/help/CSPro/symbols_json_representation.html
ObjectValue -> JSONJSON -> ValueJSON Representation
numeric✔✔
string, alpha✔✔
Array✔✔
Audio✔✔
Block
Dictionary✔
Document✔✔
File✔
Freq✔
function
Geometry✔✔
HashMap✔✔
Image✔✔
Item
List✔✔
Map
Pff
Record
Report
SystemApp✔✔
ValueSet✔✔
Return Value
The function returns the JSON representation of the symbol's metadata, and the value when applicable.
Example
List string usmca_countries = "Canada", "Mexico", "United States";
errmsg("%s", usmca_countries.getJson());
The JSON result may look similar to:
{
 
"name": "usmca_countries",
 
"type": "List",
 
"contentType": "string",
 
"value": [
   
"Canada",
   
"Mexico",
   
"United States"
  ]
}
See also: Symbol.getValueJson Function, Symbol.updateValueFromJson Function, Logic.getSymbol Action