Skip to content

System.Text.Json The JSON property name for collides with another property. #37769

@dracos1993

Description

@dracos1993

I am migrating from using Newtonsoft to the native Json library in .Net Core 3.1. One of my objects has two properties with same name but different casing, as below.

"City": "Pittsburgh",
"city": "Pittsburgh"

While serializing, I am getting the "The JSON property name for collides with another property." error. Newtonsoft seems to be handling this fine or at the very least it seems to be serializing it as it is. Is this possible in System.Text.Json? I am using v4.7.0

Edit: It looks like explicitly setting PropertyNameCaseInsensitive to false solved the issue for me, but I thought this was the default setting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions