JSON String to DateTime conversion causing empty associated list after REST call

0
I’m currently working on mapping data from a JSON response to my domain model and ran into an issue with one of the attributes.In the JSON structure, a date field is defined as a String (formatted as 'yyyy-MM-dd'), which makes sense from a JSON perspective. However, in my domain model, I need this value as a DateTime so I can later use it on the X-axis of a chart. So I tried using the built-in conversion using a Microflow to convert the string into a DateTime:The Microflow: I'm using this expression: parseDateTime($dateString, 'yyyy-MM-dd') After making the REST call, I successfully receive the GasResponse entity without any issues. However, the associated GasInterval list is always empty (size = 0), even though the API response (confirmed via logs) clearly contains around 30 items that should be in this list.So now I’m wondering:Is my date conversion approach correct?Could this conversion be the reason why the GasInterval list is not being populated?Or am I missing something in the mapping or microflow setup?Any input or suggestions would be greatly appreciated!
asked
2 answers
0

Skander,

I can't see the whole conversion microflow, does the microflow return $initial?


Also, you can define custom error handling on the Create Variable action in the microflow. Right mouse on the action and select Set Error Handling. Select Custom Without Rollback.


Next, create a log Action in the microflow. Log the latest error message and stacktrace. Finally, drag an arrow from the yellow arrow on the Create Variable action to the Log action. This will make your log action the error handling path. Also, add an End event after the Log action.


Once thats done, you can run the microflow and check the console in Studio Pro to see if there are errors generated by the date conversion. If so, troubleshoot that. If not, post the results here for further ideas about how to determine what is causing this issue.


Mike

answered
0

If the list of objects is empty, I don't think your microflow is being triggered at all. Did you check with a breakpoint in the conversion microflow?

I'd focus on nailing down why the list of objects is empty first, and take it from there.

If you're not sure you can also try mapping the list of objects without the Date-attribute, for example.


If I had to take a blind guess, maybe it's got something to do with case-sensitivity?

answered