Date Formatter in JSON

Contains a function that can be used when sending data in JSON format e.g. storing or updating data in a database using Web API to convert date formats.  This listing contains the modifyjsondata() function and instructions on how to use the function. Works with any format of Date / Date Time conversion, given that the provided date / date time format as an input to this plug-in is correct as per the JSON. It can also 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.

NOTES:

  • Please avoid the usage of an explicit dictionary key while passing a JSON String to this plug-in. 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 plug-in, 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 plug-in to perform the conversion.
Anonymous
Parents
  • Hi Alok - i've discovered a bug in this plug-in.  When a JSON string has its date updated and the date happens to be the last field in the CDT / Dictionary, the returned JSON string accidentally omits the final "]" and "}" characters.  It seems to only happen when the updated property is the last one in the cdt/dictionary, i.e. in my tests if I add an extra field after, the problem disappears.

    For example here's a test dictionary with date fields for "created" and "modified".  When i just update "created", the output is correct as I expect:

    However when i update "modified", since it's the last field, it omits the last 2 closing characters:

    This is causing us some pretty weird and severe issues in our project where we're using this plug-in, as certain things are randomly failing when the JSON text is re-loaded.

Comment
  • Hi Alok - i've discovered a bug in this plug-in.  When a JSON string has its date updated and the date happens to be the last field in the CDT / Dictionary, the returned JSON string accidentally omits the final "]" and "}" characters.  It seems to only happen when the updated property is the last one in the cdt/dictionary, i.e. in my tests if I add an extra field after, the problem disappears.

    For example here's a test dictionary with date fields for "created" and "modified".  When i just update "created", the output is correct as I expect:

    However when i update "modified", since it's the last field, it omits the last 2 closing characters:

    This is causing us some pretty weird and severe issues in our project where we're using this plug-in, as certain things are randomly failing when the JSON text is re-loaded.

Children