Skip to content

System.Text.Json not working as expected (how Newtonsoft.json did) with [FromBody] WebApi parameter #31122

@giammin

Description

@giammin

before with Newtonsoft.json when calling a webapi like this

 [HttpPost]
public async Task<ActionResult> Post([FromBody]string someValue)

this worked:

curl -H "Content-Type:application/json" https://localhost:5000/api/controller-X POST -d "'dsfdsafasf'" -v

now with System.Text.Json there are no way to pass a simple string as a parameter.

I tried various combinatin like {"someValue":"fsdfsdfsdf"} or {'someValue':'fsdfsdfsdf'} or someValue'=asdfsdfsdf but without success

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Text.JsonquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions