0

I am deserializing JSON from a WebService using the JSON.NET framework. I have to use the 3.5 R8 Version of the framework, because I am working on .NET CF.

I have never used JSON.NET before so I could use your help.

The problem

I have to deserialize a lot of different files. They all have a root that I want to skip because it means an extra "layer" on my model.

The extra layer is called "response" and is an array.

An example

{
    "response": [
        {
            "ID": 141
            "Supervisor": "Joey James",
            "Worker" :
            {
                 "Last Name": "Gates",
                 "Surname": "Jim"
            }
        }
    ]
}

Expected behavior

I want to skip the "response" object that exists in every response from the WebService. I think it could be possible using the JSON.NET framework and without having to do string functions myself. There is a similar question that is great if you want to parse one single JSON response. I need something that works for a lot of different responses with quite some data. I would like to solve this with the JSON Settings, if possible.

What I have tried so far Right now I got this working with a wrapper class. I am searching for a way to skip this step and make it better.

Thanks!

El Mac
  • 3,256
  • 7
  • 38
  • 58
  • 1
    [*What have you tried?*](http://www.whathaveyoutried.com) – Yuval Itzchakov Mar 10 '15 at 08:08
  • @GrawCube Do you know if there is a way using the JSON Settings or something similar? That solution is good if you have to do this once in one method, but not if you have to do this in a lot of methods for a lot of different responses – El Mac Mar 10 '15 at 08:15
  • There is no magic setting. You'll have to parse it manually. – Yuval Itzchakov Mar 10 '15 at 08:26

0 Answers0