-3

i have a json object that has a json array that i would love to deserialize

{
  "status": 1,
  "loans": [
    {
      "loan_id": "686",
      "client_id": "269",
      "client_name": "Byaruhanga Guard",
      "total_amount": "10000",
      "min_amount": "10000",
      "start_date": "2016-07-28 13:12:30",
      "duration": "2",
      "payment_interval": "day",
      "voucher": "92",
      "description": "FUEL",
      "when_added": "2016-07-28 13:12:30",
      "approval_status": "approved",
      "total_paid": null,
      "next_payment_date": "2016-07-29 10:12:30"
    }
  ]
}

please help.

Gilad Green
  • 36,708
  • 7
  • 61
  • 95
trinity
  • 1
  • 2
  • What have you tried to do? There are quite a few json deserializing question each day – Gilad Green Jul 28 '16 at 12:32
  • We don't write the code for you... Try it first, if something not working, then ask here... –  Jul 28 '16 at 12:34
  • 1
    This might help get you started somewhere. http://stackoverflow.com/questions/18192357/deserializing-json-object-array-with-json-net – Timmy Jul 28 '16 at 12:36
  • See [How to Convert JSON object to Custom C# object?](https://stackoverflow.com/questions/2246694/how-to-convert-json-object-to-custom-c-sharp-object) or [Deserializing JSON data to C# using JSON.NET](https://stackoverflow.com/questions/2546138/deserializing-json-data-to-c-sharp-using-json-net) or [Deserialize JSON with C#](https://stackoverflow.com/questions/7895105/deserialize-json-with-c-sharp). – dbc Jul 28 '16 at 12:38
  • See also [How to auto-generate a C# class file from a JSON object string](https://stackoverflow.com/questions/7895105/deserialize-json-with-c-sharp). – dbc Jul 28 '16 at 12:42

1 Answers1

0

use Newtonsoft.Json from NuGet package

var results= JsonConvert.DeserializeObject<string[]>(jsondata);

var loanjson=results["loans"];

var loandata= JsonConvert.DeserializeObject<string[]>(loanjson);
Rajkamal C
  • 59
  • 2