Hi there, i am using the JsonObjectConverter to parse some datatime strings from an api into FDateTime. Thats works like a charm unless once in a while when the moon stands correct it doesnt work for particular dates and i cant tell why. I put together a minimal working and failing example
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "JsonUtilities.h"
#include "Try.generated.h"
/**
*
*/
USTRUCT()
struct FSomeStruct
{
GENERATED_BODY()
UPROPERTY() FDateTime time;
};
UCLASS()
class TQD_API UTry : public UObject
{
GENERATED_BODY()
public:
static void TryParse()
{
const FString JsonStringWorks = "{\"time\": \"2022-10-10T18:58:42.189834+02:00\"}";
FSomeStruct OutPutWorks;
FJsonObjectConverter::JsonObjectStringToUStruct<FSomeStruct>(JsonStringWorks, &OutPutWorks, 0, 0, true);
const FString JsonStringFails = "{\"time\": \"2022-10-10T18:51:58.999814+02:00\"}";
FSomeStruct OutPutFails;
FJsonObjectConverter::JsonObjectStringToUStruct<FSomeStruct>(JsonStringFails, &OutPutFails, 0, 0, true);
}
};
The second example fails. I tried stepping through engine code but the converter seems like magic to me. Both dates should be properly iso 8601 formatted.