Skip to content

Deerialize utc-time different from the original field utc-time #134

@hxmcn

Description

@hxmcn

For a simple Object with DateTime field, assign UTC-Time to it and serialize the object to json-text, then deserialize an object from the same json-text, the UTC-Time does not match with the original value (your time zone should not be UTC to reproduce the bug).

Code Example:

public class MUtcTime
{
public long ID { get; set; }
public DateTime LogUtcTime { get; set; }
}

    public static void Test()
    {
        var m = new MUtcTime
        {
            ID = 100,
            LogUtcTime = DateTime.UtcNow,
        };

        var jText = fastJSON.JSON.ToJSON(m);
        var gBack = fastJSON.JSON.ToObject<MUtcTime>(jText);
        if (m.LogUtcTime == gBack.LogUtcTime)
            Console.Write("Pass");
        else
            Console.Write("Failed");
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions