Skip to content

Parsing a blank "" as null #5

@sporty81

Description

@sporty81

I am parsing a string to a POCO object. One of the fields is a nullable long. But in the json it has the value surrounded by strings like so and looks like an empty string.

{
"reqBegin": "1431462651083", (long?)
"reqEnd": "" (long?) <-- should deserialize to null
}

The parser blows up on reqEnd if it is an empty string, instead of setting the object's field value to a null.

I tried to fix this and submit a pull request but I am struggling to figure out how the ParseInt64 and Obj() methods work.

Can someone fix this for me?

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