---
title: "Parsing JSON in C# issue"  
description: "Parsing JSON in C# issue"  
author: "Anonymous User"  
published: 2014-04-01  
updated: 2014-04-11  
canonical: https://www.mindstick.com/forum/2009/parsing-json-in-c-sharp-issue  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Parsing JSON in C# issue

I have a [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) [parsing](https://www.mindstick.com/interview/1700/what-are-the-standard-ways-of-parsing-xml-document) the json, and I hope someone could help.

Here's a JSON [response](https://www.mindstick.com/forum/12719/how-to-make-response-write-display-special-character-like-lt-gt) I get from the [service](https://www.mindstick.com/articles/105963/online-thesis-writing-service-for-college-kids-with-disabilities)

```
{    "name":"UPDATE_QUEUE",    "args":[        {            "message":[                {                    "service_id":1,                    "entered":"01:00",                    "polaziste":"Tibljaska cesta 11, Rijeka",                    "phone_number":"0992173439",                    "destinacija":"Zabica 1, Rijeka",                    "order":1,                    "passanger_count":1,                    "order_arival":"01:00"                },                {                    "service_id":2,                    "entered":"01:00",                    "polaziste":"Cavle 15, Cavle",                    "phone_number":"08001234",                    "destinacija":"Centar 1, Matulji",                    "order":1,                    "passanger_count":3,                    "order_arival":"01:00"                }            ]        }    ]}
```

And here's my [Class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) for the [JSON object](https://www.mindstick.com/forum/699/how-to-parse-into-json-object-using-json-parse-in-node-js)

```
    class DispatchQueueItem    {        public RootObject RootObject { get; set; }    }    public class Message    {        public int service_id { get; set; }        public string entered { get; set; }        public string polaziste { get; set; }        public string phone_number { get; set; }        public string destinacija { get; set; }        public int order { get; set; }        public int passanger_count { get; set; }        public string order_arival { get; set; }    }    public class Arg    {        public List<Message> message { get; set; }    }    public class RootObject    {        public string name { get; set; }        public List<Arg> args { get; set; }    }
```

And here's my call

API.jsonObjects.DispatchQueueItem items

= [JsonConvert.DeserializeObject](https://www.mindstick.com/forum/161290/how-does-jsonconvert-deserializeobject-work-in-c-sharp)<API.jsonObjects.DispatchQueueItem>(data.MessageText);

I am using Newtonsoft JSON for [c# .NET](https://www.mindstick.com/forum/159581/how-to-design-a-calculator-program-in-c-sharp-dot-net)

When i try to call items.RootObject.name i don't get anything, not even [trigger](https://www.mindstick.com/blog/167/triggers-in-wpf) for the [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) ( for example messageBox.Show(items.RootObject.name) ) .

## Replies

### Reply by Pravesh Singh

Hi Ashish,\

You are deserializing to the wrong type. You should call

JsonConvert.DeserializeObject<API.jsonObjects.RootObject>(data.MessageText);

The RootObject class matches the JSON which you are deserializing.


---

Original Source: https://www.mindstick.com/forum/2009/parsing-json-in-c-sharp-issue

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
