• <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
      • Numeric Values
      • String Values
      • Symbol Functions
        • Symbol.getName Function
        • Symbol.getLabel Function
        • Symbol.getJson Function
        • Symbol.getValueJson Function
        • Symbol.setValueFromJson 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
      • StringWriter 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
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Symbol.getValueJson Function

Format
s = symbol_name.getValueJson(ʃserializationOptions := serialization_optionsʅ);
Description
The Symbol.getValueJson function returns the JSON representation of a symbol's value. 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.getJson function if you want to work with the symbol's metadata, or both the metadata and value. You can also use the Logic.getSymbolValue action to get a symbol's value.
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 all JSON representations feature will come in a future release.
ObjectValue -> JSONJSON -> ValueSerialization
numeric✔✔CSPro ⇄ JSON Conversions: Numeric Values
string, alpha✔✔CSPro ⇄ JSON Conversions: String Values
Array✔✔CSPro ⇄ JSON Conversions: Array Object
Audio✔✔CSPro ⇄ JSON Conversions: Audio Object
Block
Dictionary✔
Document✔✔CSPro ⇄ JSON Conversions: Document Object
File✔
Freq✔
function
Geometry✔✔CSPro ⇄ JSON Conversions: Geometry Object
HashMap✔✔CSPro ⇄ JSON Conversions: HashMap Object
Image✔✔CSPro ⇄ JSON Conversions: Image Object
Item
List✔✔CSPro ⇄ JSON Conversions: List Object
Map
Pff
Record
Report✔✔CSPro ⇄ JSON Conversions: Report Object
StringWriter✔✔CSPro ⇄ JSON Conversions: StringWriter Object
SystemApp✔✔
ValueSet✔✔
Return Value
The function returns the JSON representation of the symbol's value. If the function is called on a symbol that does not support the serialization of its value as JSON, a runtime error is issued and the function returns a blank string.
Example
List string usmca_countries = "Canada", "Mexico", "United States";
errmsg("%s", usmca_countries.getValueJson());
The JSON result may look similar to:
[
 
"Canada",
 
"Mexico",
 
"United States"
]
See also: Symbol.getJson Function, Symbol.setValueFromJson Function, Logic.getSymbolValue Action