View this page in the latest version of Appian. a!fromJson() Function Share Share via LinkedIn Reddit Email Copy Link Print On This Page Converts a JSON string into an Appian value. Parameters a!fromJson( jsonText, usePreciseDecimals ) Keyword Type Description jsonText Text The text to convert from a JSON string to an Appian value. usePreciseDecimals Boolean Determines whether decimal values are returned as Number (Decimal Precise) in Appian. When false, values are returned as Number (Decimal Floating). Default: true. Returns One of: Dictionary List of Integer List of Number (Decimal Precise) or List of Number (Decimal Floating), depending on the usePreciseDecimals parameter List of Text List of Dictionary List of Boolean List of Variant Using the function The following sections cover important details about the a!fromJson() function. Using the usePreciseDecimals parameter The usePreciseDecimals parameter determines which data type a!fromJson() returns for numeric values in the JSON string. The usePreciseDecimals parameter is true by default. When usePreciseDecimals is true, a!fromJson() returns numeric values as follows: Decimals: Decimal values return as Number (Decimal Precise), whether or not the value is enclosed in quotation marks in the JSON string. Large integers: Integer values that exceed the limits of the Number (Integer) type return as Number (Decimal Precise). When usePreciseDecimals is false, a!fromJson() returns numeric values as follows: Decimals in quotation marks: Decimal values enclosed in quotation marks return as Text. Decimals without quotation marks: Decimal values that are not enclosed in quotation marks return as Number (Decimal Floating). Integers: Integer values return as Number (Integer), or as Text when the value exceeds the limits of the Number (Integer) type. Automatic casting Certain JSON formats are automatically converted to Appian Data Types. The following table lists the JSON formats and their associated data types when usePreciseDecimals is true (the default). JSON Format Appian Data Type String Date (when supported date format is found), Date and Time (when supported datetime format is found), or Text (when no supported date or datetime format is found). Number Number (Decimal Precise) (when the number is a decimal or a large integer that exceeds the limits of the Number (Integer) type), or Number (Integer) (when the number is an integer that fits in a signed 32-bit integer). Object Dictionary Array List of Variant Boolean Boolean Null null (Text) Note: The automatic casting behavior for numbers is different when usePreciseDecimals is false. See Using the usePreciseDecimals parameter. Date and datetime formats If the JSON text includes fields that match the following date and datetime formats, they are automatically detected and converted to the appropriate Date or Date and Time data type. The following table lists the supported date and datetime formats that are converted to Appian data types: Supported Format Example ISO Date 2019-03-25 Date with UTC Timezone 2019-03-25Z Datetime without Timezone 2019-03-25T20:17:46 UTC Datetime 2019-03-25T20:17:46Z UTC Datetime without Seconds 2019-03-25T20:17Z UTC Datetime with Decimal Fraction of a Second 2019-03-25T20:17:46.384Z Offset Datetime 2019-03-25T20:17:46+01:00 Offset Datetime Hour Only 2019-03-25T20:17:46+01 Offset Datetime No Colon 2019-03-25T20:17:46+0100 Offset Datetime with ZoneId 2019-03-25T20:17:46+01:00[Europe/Paris] Note: Appian Date and Time data type does not include seconds. If the JSON field includes seconds, it will be ignored. If a timezone is not explicitly stated, it's assumed to be in Universal Time Coordinated (UTC)/Greenwich Mean Time (GMT). However, it's adjusted to the logged in user's time zone (accounting for daylight saving time) when displayed. For example, 2019-03-25T20:17:46 displays as: 3/25/2019 4:17 PM EDT for a user whose time zone is set to (UTC-05:00) Eastern Time (America/New_York) 3/25/2019 8:17 PM GMT+00:00 for a user whose time zone is set to Use system default: (UTC) Greenwich Mean Time (GMT). Examples The following examples demonstrate the a!fromJson() function. Convert a JSON string to an Appian value This example shows how to convert a JSON string to Appian data types. It uses the default usePreciseDecimals value of true, so decimal values and integers that exceed the limits of the Number (Integer) type return as Number (Decimal Precise). 1 2 3 4 5 6 7 8 9 10 11 a!fromJson("[{ ""transId"":9223372036854775807, ""submitTimeUTC"":""2019-07-16T14:52:26Z"", ""submitTimeLocal"":""2019-07-16T07:52:26"", ""transactionOk"":true, ""accountType"":""Visa"", ""accountNumber"":123456, ""settleAmount"":412.97, ""product"":"""", ""marketType"":[""Business"",""Clothing"",""Child""] }]") Returns 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 List of Dictionary: 1 item Dictionary /*64-Bit Integer converted to Number (Decimal Precise)*/ transId: 9223372036854775807 /*UTC Datetime without Seconds converted to Date and Time*/ submitTimeUTC: 7/16/2019 2:52 PM GMT+00:00 /*Datetime without Timezone converted to Date and Time*/ submitTimeLocal: 7/16/2019 7:52 AM GMT+00:00 /*Boolean data type*/ transactionOk: true /*Text data type*/ accountType: "Visa" /*Number (Integer) data type*/ accountNumber: 123456 /*Number (Decimal Precise) data type*/ settleAmount: 412.97 /*Null value*/ product: null (Text) /*Array*/ marketType: List of Text String: 3 items "Business" "Clothing" "Child" Cast a JSON string to a record type This example shows how to cast a JSON string to the Exchange Rate record type. When casting JSON data to a record type, Appian automatically matches the keys to the record type's fields. Any non-matching key names are ignored. 1 2 3 4 5 6 7 8 cast( recordType!AT Exchange Rates, a!fromJson( "{""id"":301,""sourceCurrencyId"":""1"", ""targetCurrencyId"":""2"",""rate"":0.85920437,""effectiveDate"":""6/2/2026""}", true ) ) Feature compatibility The table below lists this function's compatibility with various features in Appian. Feature Compatibility Note Portals Incompatible Offline Interfaces Incompatible Sync-Time Custom Record Fields Incompatible Real-Time Custom Record Fields Incompatible Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. Process Reports Incompatible Cannot be used to configure a process report. Process Events Partially compatible If autoscale is enabled, can be used to configure a supported process event node (such as a start event or timer event). Process Autoscaling Compatible Can be used in autoscaled processes. Event Consumer Filter Conditions Compatible Can be used in filter conditions. Event Consumer Event Handlers Compatible Can be used in event handler expressions. Old versions There are older versions of this function . You can identify older versions by looking at the name to see if there is a version suffix. If you are using an old version, be sure to refer to the corresponding documentation from the list below. Old Versions Reason for Update a!fromJson_19r2 Now automatically converts date and datetime fields to the appropriate Date and Date and Time data types instead of a string. Also converts 64-bit integers to string instead of returning null. a!fromJson_26r9 Support the Number (Decimal Precise) data type. To use the latest version of the function, replace the function with a version suffix with a new function reference. To learn more about how Appian handles this kind of versioning, see the Function and Component Versions page. Feedback Was this page helpful? SHARE FEEDBACK Loading...