0

I've JSON Payload as below:

{
  "Size": "100",
  "ApplicationSource": "AMAZON",
  "SearchData": [
   {
     "key": "orderID",
     "value": ["23434332", "45654456",...]  
   },
   {
     "key": "orderGroupCode",
     "value": "101"
    }
  ]
} 

The value for orderID key in SearchData element can be single value or multiple values and are dynamic like this:

"value": "23434332"
or
"value": ["23434332", "45654456","5545645"]

How to create JSON object and parse and Execute RestClient request in C#.

venkat
  • 5,648
  • 16
  • 58
  • 83
  • asked already multiple times ... you need create custom converter – Selvin Dec 28 '19 at 20:41
  • 6
    Does this answer your question? [How to handle both a single item and an array for the same property using JSON.net](https://stackoverflow.com/questions/18994685/how-to-handle-both-a-single-item-and-an-array-for-the-same-property-using-json-n) – devNull Dec 28 '19 at 20:44
  • https://www.newtonsoft.com/json – JGFMK Dec 28 '19 at 21:14
  • What JSON serializer or framework are you using? Assuming you are using [tag:json.net] then [How to handle both a single item and an array for the same property using JSON.net](https://stackoverflow.com/q/18994685/3744182) is the correct duplicate. But if you're not using Json.NET then please let us know what you are using. – dbc Dec 29 '19 at 01:16

0 Answers0