Skip to content

ToJSON returns invalid json #980

@enricobenedos

Description

@enricobenedos

Hello,

I found a bug in ToJSON method. It returns an invalid json because it doesn't escape string fields as expected by json standard specification.
A specific example is:

    var message = new QuickFix.Message();
    message.SetField(new Text("Some text.\r\n With some more text"));

this will produce this json string:

{
    "Header": {},
    "Body": {
        "Text": "Some text.\r\n With some more text"
    },
    "Trailer": {}
}

that is an invalid json. In fact when I try to deserialize it with System.Text.Json it generates a JsonReaderException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions