Click here to Skip to main content
15,850,103 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need to create next button Pin
Member 1611639316-Oct-23 7:17
Member 1611639316-Oct-23 7:17 
GeneralRe: Need to create next button Pin
Dave Kreskowiak16-Oct-23 8:19
mveDave Kreskowiak16-Oct-23 8:19 
AnswerRe: Need to create next button Pin
RedDk16-Oct-23 7:49
RedDk16-Oct-23 7:49 
QuestionTransfer data between MFC Application and c# application using NamedPipe Pin
manoharbalu13-Oct-23 2:37
manoharbalu13-Oct-23 2:37 
AnswerRe: Transfer data between MFC Application and c# application using NamedPipe Pin
Richard Andrew x6413-Oct-23 3:28
professionalRichard Andrew x6413-Oct-23 3:28 
AnswerRe: Transfer data between MFC Application and c# application using NamedPipe Pin
JudyL_MD13-Oct-23 6:05
JudyL_MD13-Oct-23 6:05 
QuestionCreating a JSON File from a CSV file in C# Pin
Member 1611347712-Oct-23 3:19
Member 1611347712-Oct-23 3:19 
AnswerRe: Creating a JSON File from a CSV file in C# Pin
OriginalGriff12-Oct-23 3:29
mveOriginalGriff12-Oct-23 3:29 
Concentrate on reading the CSV first - I use A Fast CSV Reader[^] - it does all the donkey work for you and can load it into a DataTable very easily.

When you have that, create the appropriate C# classes to hold your expected data - running your JSON data sample through Convert JSON to C# Classes Online - Json2CSharp Toolkit[^] gave these so that'll be a good place to start:
C#
public class Metric
{
    public int Metric { get; set; }
    public string Organisation { get; set; }
    public int Value { get; set; }
    public DateTime Datetime { get; set; }
    public int? value { get; set; }
    public DateTime? datetime { get; set; }
}

public class Root
{
    public DateTime Time { get; set; }
    public string Control_Code { get; set; }
    public List<Metric> metrics { get; set; }
}
Then process the table data to fill out your classes. When you have them, use Json.NET - Newtonsoft[^] to produce the JSON string - you can do what you like with it from there.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

AnswerRe: Creating a JSON File from a CSV file in C# Pin
jschell12-Oct-23 6:17
jschell12-Oct-23 6:17 
AnswerRe: Creating a JSON File from a CSV file in C# Pin
Gerry Schmitz12-Oct-23 9:36
mveGerry Schmitz12-Oct-23 9:36 
GeneralRe: Creating a JSON File from a CSV file in C# Pin
OriginalGriff12-Oct-23 10:07
mveOriginalGriff12-Oct-23 10:07 
GeneralRe: Creating a JSON File from a CSV file in C# Pin
Gerry Schmitz12-Oct-23 10:28
mveGerry Schmitz12-Oct-23 10:28 
GeneralRe: Creating a JSON File from a CSV file in C# Pin
OriginalGriff12-Oct-23 11:20
mveOriginalGriff12-Oct-23 11:20 
GeneralRe: Creating a JSON File from a CSV file in C# Pin
jschell13-Oct-23 8:09
jschell13-Oct-23 8:09 
QuestionItemObservableCollection Pin
rex648-Oct-23 8:34
rex648-Oct-23 8:34 
AnswerRe: ItemObservableCollection Pin
Gerry Schmitz8-Oct-23 8:55
mveGerry Schmitz8-Oct-23 8:55 
QuestionHow do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work4-Oct-23 12:32
Rod at work4-Oct-23 12:32 
AnswerRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Richard MacCutchan4-Oct-23 21:55
mveRichard MacCutchan4-Oct-23 21:55 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 3:38
Rod at work5-Oct-23 3:38 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Richard MacCutchan5-Oct-23 3:43
mveRichard MacCutchan5-Oct-23 3:43 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 4:24
Rod at work5-Oct-23 4:24 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 4:54
Rod at work5-Oct-23 4:54 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Richard MacCutchan5-Oct-23 5:18
mveRichard MacCutchan5-Oct-23 5:18 
AnswerRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
jschell5-Oct-23 6:48
jschell5-Oct-23 6:48 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 11:33
Rod at work5-Oct-23 11:33 

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.