0

I need to call Google Custom Search API in my .NET 2.0 project. I cannot use the Google Libraries because those are written in .NET 3.5. I've tried to compile them in .NET 2.0 but there are big dependencies in LINQ and Json.NET 3.5 version of the library.

I tried to use the 2.0 version of the Json.NET library but i cannot get the JSON response to be deserialized into one of my custom object classes. The problem is with deserialization. Can i ignore fields in deserialization? The deserialization always returns error because i cannot get the class that represents the JSON answer from Google.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
TiagoDias
  • 1,785
  • 1
  • 16
  • 21

1 Answers1

0

I managed to get it to work. I've used this site: Generate Class based on JSON to get the full representation of my JSON in .Net Classes. After that i got an error on deserialization because google is returning this value: "msvalidate.01" and it could not get represented in class for deserialization.

After i decorate with this attribute

[JsonProperty("msvalidate.01")]
public string msvalidate;

i managed to get it to work.

TiagoDias
  • 1,785
  • 1
  • 16
  • 21