- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
This shows you the differences between two versions of the page.
expression function - field to json [2016/09/14 18:19] |
expression function - field to json [2016/09/14 18:19] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== FIELD_TO_JSON (Expression Function) ====== | ||
+ | ===== Purpose ===== | ||
+ | The **Field to JSON** function (FIELD_TO_JSON) takes the input of a field value and converts it to a JSON encoded string. | ||
+ | |||
+ | {{::field_to_json.png?direct&600|}} | ||
+ | ===== Parameters ===== | ||
+ | The **Field to JSON** function has one input parameter: | ||
+ | |||
+ | ==== Field Value ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|field]] value | ||
+ | |||
+ | The builder can enter one field value. The builder should use the [[Query Builder]] to choose a field that contains a value. | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | The output of the **Field to JSON** function is a string comprised of the value(s) from a field. Simple fields such as short text will return a double quoted string with the value properly escaped. For multiple part fields such as [[Field Type - Address|address]], [[Field Type - Telephone|telephone]], or [[Field Type - Multiple Part|multiple part]] the stored value labels will be used as keys and a simple object will be returned. For example an address might look like {"street": "123 Main St","city": "Small Town","state": "PA","zip": "17000"}. If the multiple value option is turned on for the field then an array of objects will be returned. | ||
+ | ===== Example ===== | ||
+ | |||
+ | This function is most commonly used when communicating with a third party system that can receive values that are JSON encoded |