0

I'm calling a webservice, that can take multiple id's as inputs

/getItems?ids=1,2

And it returns this information (i have no control over the results)

{
    "status": {
        "timestamp": "2022-10-26T15:04:37.036Z",
    },
    "data": {
        "1": {
            "id": 1,
            "name": "abc"
            "quote": {
                "USD": {
                    "price": 20842
                }
            }
        },
        "2": {
            "id": 2
            "name": "xyz"
            "quote": {
                "USD": {
                    "price": 20842
                }
            }
        }       
    }
}

However that is horrible to map as an object, as your have to map out all the possible id's (there are a few hundred...)

So i'd like to convert the result to something like this

{
    "status": {
        "timestamp": "2022-10-26T15:04:37.036Z",
    },
    "data": [
        {
            "id": 1,
            "name": "abc"
            "quote": {
                "USD": {
                    "price": 20842
                }
            }
        },
        {
            "id": 2
            "name": "xyz"
            "quote": {
                "USD": {
                    "price": 20842
                }
            }
        }       
    ]
}

I made multiple attemps with JsonConverter, but it's just not working out...

Any help would be appreciated

Robert Hoffmann
  • 2,366
  • 19
  • 29

0 Answers0