0

I have the following JSON:

{
likes: {
data: [ ],
summary: {
total_count: 1
}
},
comments: {
data: [ ],
summary: {
order: "chronological",
total_count: 0
}
},
created_time: "2015-12-06T15:45:27+0000",
id: "111645995872678"
}

I just need total_count of shares and likes, how to get these values out from this json ?

I am new to C# so don't mind please.

Zubair
  • 5,833
  • 3
  • 27
  • 49
  • 2
    Take a look at JSON.NET. You can install it as nuget package. It allows you to handle JSON messages. – Ron Deijkers Dec 09 '15 at 19:32
  • @RonDeijkers, I don't want to use 3rd party libs. Any native C# solution. – Zubair Dec 09 '15 at 19:33
  • See JavascriptSerializer. Also, copy this JSON to clipboard, create a new class, while it's code window is open, go to edit menu / paste special and click paste JSON as classes – Oguz Ozgul Dec 09 '15 at 19:38
  • 2
    Rejecting 3rd-party solutions out of hand is a waste of time, which equates to a waste of $$. – B. Clay Shannon-B. Crow Raven Dec 09 '15 at 19:38
  • https://msdn.microsoft.com/en-us/library/bb310857.aspx – Oguz Ozgul Dec 09 '15 at 19:40
  • https://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer(v=vs.110).aspx – Oguz Ozgul Dec 09 '15 at 19:41
  • @Zubair JSON.NET is written in C# and you can download the code. You could ofcourse write your own parser but as B. Clay Shannon mentioned, that would be a waste of time. Another option might be to use a regular expression but I'm not sure how error prone that would be in your situation. – Ron Deijkers Dec 09 '15 at 19:54
  • @RonDeijkers, Agree with you :) Post its usage way I will accept the answer – Zubair Dec 09 '15 at 19:57
  • @Zubair The question was closed no one can answer anymore. However, even if you rephrase this will be a duplicate answer (Parse json without json.net). Check this out. http://stackoverflow.com/questions/9573119/how-to-parse-json-without-json-net-library – thinklarge Dec 09 '15 at 20:00

0 Answers0