0

Action

[HttpPost("TestArray")]
public IActionResult TestArray([FromBody] int[]a )
{
    return Ok( a);
}

Output in postman

{
    "": [
        "The input was not valid."
    ]
}

postman request

I tried to send it as [FromQuery] it's pass but when I use Name property for FromQuery as [FromQuery (Name ="a")], but frombody don't have any property and when i didn't send any thing return same error what i should to do to if want an empty array

1 Answer 1

1

You can try to send body as JSON

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

okay thanks but what i should to do if i have multiple parameter like int []a , string Name and so thanks
if you want to pass more data. The best option is creating a model for it. For example, { values: [1,2,3], name: "my name", address: "add 123" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.