Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
GeneralRe: UTC Time Conversion Pin
milo-xml15-May-17 8:04
professionalmilo-xml15-May-17 8:04 
QuestionProblem in deserializing a JSON object in C# Pin
Farhad Eft15-May-17 3:07
Farhad Eft15-May-17 3:07 
AnswerRe: Problem in deserializing a JSON object in C# Pin
Dave Kreskowiak15-May-17 4:24
mveDave Kreskowiak15-May-17 4:24 
AnswerRe: Problem in deserializing a JSON object in C# Pin
Richard MacCutchan15-May-17 5:54
mveRichard MacCutchan15-May-17 5:54 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard Deeming15-May-17 7:48
mveRichard Deeming15-May-17 7:48 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard MacCutchan15-May-17 7:55
mveRichard MacCutchan15-May-17 7:55 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard Deeming15-May-17 7:59
mveRichard Deeming15-May-17 7:59 
AnswerRe: Problem in deserializing a JSON object in C# Pin
Richard Deeming15-May-17 7:52
mveRichard Deeming15-May-17 7:52 
Farhad Eft wrote:
JsonConvert.DeserializeObject<List<NewsItem>>(json);

Farhad Eft wrote:
new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<News>>(json);

The JSON you've posted is neither a List<NewsItem> nor a List<News>; it is simply a single News object.
C#
string json = File.ReadAllText("data3.json");
News allNews = JsonConvert.DeserializeObject<News>(json);
foreach (NewsItem item in allNews.data)
{
    foreach (string title in item.title)
    {
        Console.WriteLine(title);
    }
    
    foreach (string body in item.body)
    {
        Console.WriteLine(body);
    }
    
    Console.WriteLine();
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Problem in deserializing a JSON object in C# Pin
Farhad Eft16-May-17 20:21
Farhad Eft16-May-17 20:21 
QuestionC# hierarchical data structure and .NET garbage collection ? Pin
BillWoodruff14-May-17 14:40
professionalBillWoodruff14-May-17 14:40 
AnswerRe: C# hierarchical data structure and .NET garbage collection ? Pin
Luc Pattyn14-May-17 15:25
sitebuilderLuc Pattyn14-May-17 15:25 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? Pin
BillWoodruff14-May-17 20:44
professionalBillWoodruff14-May-17 20:44 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? PinPopular
lmoelleb14-May-17 23:31
lmoelleb14-May-17 23:31 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? Pin
Luc Pattyn14-May-17 23:40
sitebuilderLuc Pattyn14-May-17 23:40 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? Pin
Pete O'Hanlon14-May-17 23:55
mvePete O'Hanlon14-May-17 23:55 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? Pin
BillWoodruff15-May-17 5:40
professionalBillWoodruff15-May-17 5:40 
GeneralRe: C# hierarchical data structure and .NET garbage collection ? Pin
OriginalGriff15-May-17 6:12
mveOriginalGriff15-May-17 6:12 
AnswerRe: C# hierarchical data structure and .NET garbage collection ? Pin
kalberts23-May-17 22:38
kalberts23-May-17 22:38 
QuestionHelp my C# Pin
Arman Petrosyan12-May-17 9:27
Arman Petrosyan12-May-17 9:27 
AnswerRe: Help my C# Pin
NotPolitcallyCorrect12-May-17 9:48
NotPolitcallyCorrect12-May-17 9:48 
AnswerRe: Help my C# Pin
Patrice T12-May-17 15:17
mvePatrice T12-May-17 15:17 
QuestionHow should i do tracing in c# using zipkin Pin
yeswanthkumar11-May-17 19:18
yeswanthkumar11-May-17 19:18 
AnswerRe: How should i do tracing in c# using zipkin Pin
Chris Quinn11-May-17 20:57
Chris Quinn11-May-17 20:57 
GeneralRe: How should i do tracing in c# using zipkin Pin
yeswanthkumar11-May-17 21:05
yeswanthkumar11-May-17 21:05 
AnswerRe: How should i do tracing in c# using zipkin Pin
Pete O'Hanlon11-May-17 21:08
mvePete O'Hanlon11-May-17 21:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.