
Date Formatter in JSON
by Cognizant
Description
Contains a function, which can be used to format the given Date / Date Time attribute (or) list of attributes values inside a given JSON String.
As a response this plugin returns the same JSON string (JsonObject, JsonArray) back with having the dates in the requested format.
NOTES: -> Please avoid the usage of an explicit dictionary key while passing a JSON String to this plugin example: {"EmployeeDetails": [{"id": "1", "name": "Demo"}, {"id": "2", "name": "Demo1"}]} , Here "EmployeeDetails" is the explicit dictionary Key, Instead please pass it as below: [{"id": "1", "dob": "01-02-2019"}, {"id": "2", "dob": "15-07-2019"}] -- Here this JsonArray is converted using the existing CDT Array i.e. toJson(YOUR_CDT/YOUR_CDT_ARRAY)
-> Please avoid the usage of this plugin, if you want to modify a Date / Date Time property of a Child CDT (Nested) through the parent example: EmployeeDetails.PersonalDetails.DOB, Here EmployeeDetails is the parent and PersonalDetails is the child (Nested CDT) But if your date property, the part of your parent CDT i.e. EmployeeDetails.DOB then you can use this plugin to perform the conversion.
-> In case if the deployment of this plugin fails, due to unavailability of the latest JSON JAR's existing as part of your Installed Appian version, please make the use of the old Jar file (attached).
Features
-> This plugin contains the modifyjsondata() function and "Steps to Follow" PDF file explaining about the usage of this plugin -> Works with any format of Date / Date Time conversion, given that the provided date / date time format as an input to this plugin is correct as per the JSON -> Can modify list of Date attributes of the JSONObject / JSONArray at a time (e.g. createdOn (Date), modifiedOn (Date)), instead of doing it one after the another -> Great in terms of performance
Release notes
Release Notes
-- Added the capability to work with JSONObject as well as JSONArray
-- Added the capability of modifying array/list of Date/Date Time attributes of a JSONObject / JSONArray at a time, instead of doing that one after another like earlier
-- Improved the code performance
Version history (1)
1.0.0
[MIGRATED] 1) Usually we will find the requirement to Store or Update the data in Database using Web API, in such case we need to send the data in JSON Format
- If we are converting our CDT to JSON, and if there is any attribute of type Date, then the Appian Format Date data i.e. (mm/dd/yyyy) gets converted into Text Format date data i.e. (yyyy-mm-dd), so in such case we will find the requirement to modify the Date attribute value with in the JSON by retaining its all other attribute values
modifyjsondata(datePropertyName, jsonValue, existingDateFormat, newDateFormat)