-1

I am creating a list like this

List<int> items = new List<int>();

items contains the following numbers

1006
1007

I want to be able to represent these numbers in json and pass it to my webapi from postman. How can I represent these numbers in json.

Baba
  • 2,059
  • 8
  • 48
  • 81
  • 1
    There are some many duplicates of this, does this answer your question? [Serializing a list to JSON](https://stackoverflow.com/questions/9110724/serializing-a-list-to-json) Actually, `JsonConvert.SerializeObject(items)` will be enough – Pavel Anikhouski Mar 05 '20 at 17:59
  • I am not looking to do that in code if you read my question very well. I want to see what it will look like after json convert. Remember I am passing this in postman not in code. – Baba Mar 05 '20 at 18:03
  • 1
    Then your question is not about code and programming, it seems to be off-topic here – Pavel Anikhouski Mar 05 '20 at 18:06

2 Answers2

1

If you want to pass array of numbers in postman as a json, pass it like

[
   100,
   200
]

enter image description here

Prasad Telkikar
  • 15,207
  • 5
  • 21
  • 44
0

In postman your json would (minimally) look like:

[1006, 1007]

If it has a name and is part of an object with some other stuff:

{ "something":"else", "items":  [1006, 1007]}
Caius Jard
  • 72,509
  • 5
  • 49
  • 80