Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
AnswerRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:14
mveOriginalGriff23-Oct-15 23:14 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:21
seipekm23-Oct-15 23:21 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:31
mveOriginalGriff23-Oct-15 23:31 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:38
seipekm23-Oct-15 23:38 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff23-Oct-15 23:42
mveOriginalGriff23-Oct-15 23:42 
GeneralRe: JSON to DataGrid View Pin
seipekm23-Oct-15 23:52
seipekm23-Oct-15 23:52 
GeneralRe: JSON to DataGrid View Pin
OriginalGriff24-Oct-15 0:08
mveOriginalGriff24-Oct-15 0:08 
GeneralRe: JSON to DataGrid View Pin
seipekm24-Oct-15 1:24
seipekm24-Oct-15 1:24 
Can you make an example for me?
I'm just not plan.

i tried this

files.cs
C#
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataGridJsonTest
{
    class Data
    {
        [JsonProperty("files")]
        public List<Files> Files { get; set; } 
    }

    class Files
    {
        [JsonProperty("date")]
        public string date;

        [JsonProperty("gcodeAnalysis")]
        public List<GcodeAnalysis> GcodeAnalysis { get; set; }

        [JsonProperty("hash")]
        public string hash;

        [JsonProperty("links")]
        public string links;

        [JsonProperty("name")]
        public string name;

        [JsonProperty("origin")]
        public string origin;

        [JsonProperty("refs")]
        public List<Refs> refs { get; set; }

        [JsonProperty("size")]
        public string size;

        [JsonProperty("type")]
        public string type;
    }

    class GcodeAnalysis
    {
        [JsonProperty("estimatedPrintTime")]
        public string estimatedPrintTime;

        [JsonProperty("filament")]
        public List<Filament> Filament { get; set; }
    }

    class Filament
    {
        [JsonProperty("tool0")]
        public List<Tool0> Tool0 { get; set; }
    }

    class Tool0
    {
        [JsonProperty("length")]
        public string length;

        [JsonProperty("volume")]
        public string volume;
    }

    class Refs
    {
        [JsonProperty("download")]
        public string download;

        [JsonProperty("resource")]
        public string resource;
    }

}


form1.cs
C#
using MetroFramework.Forms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DataGridJsonTest
{
    public partial class Form1 : MetroForm
    {
        public Form1()
        {
            InitializeComponent();

            WebClient client = new WebClient();
            var json = client.DownloadString("http://192.168.1.182/api/files/local?apikey=A6C6603BB2F743D6B084D7F52E568011");
            Data item = JsonConvert.DeserializeObject<Data>(json);
        }
    }
}


same problem
Questionavro - c# to Java, on Flush or Close - “The underlying connection was closed” C# side upon Java HttpExchange.getResponseBody().flush() Pin
devvvy22-Oct-15 14:28
devvvy22-Oct-15 14:28 
QuestionUsing NLog in many classes Pin
Member 1206160022-Oct-15 7:08
Member 1206160022-Oct-15 7:08 
AnswerMessage Closed Pin
22-Oct-15 8:04
mveGerry Schmitz22-Oct-15 8:04 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 8:28
Member 1206160022-Oct-15 8:28 
AnswerRe: Using NLog in many classes Pin
John Torjo22-Oct-15 10:11
professionalJohn Torjo22-Oct-15 10:11 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 10:34
Member 1206160022-Oct-15 10:34 
GeneralRe: Using NLog in many classes Pin
John Torjo22-Oct-15 10:36
professionalJohn Torjo22-Oct-15 10:36 
GeneralRe: Using NLog in many classes Pin
Member 1206160022-Oct-15 11:16
Member 1206160022-Oct-15 11:16 
GeneralRe: Using NLog in many classes Pin
John Torjo22-Oct-15 22:53
professionalJohn Torjo22-Oct-15 22:53 
GeneralRe: Using NLog in many classes Pin
Richard Deeming23-Oct-15 1:40
mveRichard Deeming23-Oct-15 1:40 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:15
Member 1206160023-Oct-15 2:15 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:29
Member 1206160023-Oct-15 2:29 
QuestionHow to change Font in Word by C# Pin
naylynn22-Oct-15 3:54
naylynn22-Oct-15 3:54 
AnswerRe: How to change Font in Word by C# Pin
Eddy Vluggen22-Oct-15 8:37
professionalEddy Vluggen22-Oct-15 8:37 
GeneralRe: How to change Font in Word by C# Pin
naylynn25-Oct-15 11:10
naylynn25-Oct-15 11:10 
QuestionCheck Remote Computer Windows Services Pin
Jassim Rahma21-Oct-15 23:07
Jassim Rahma21-Oct-15 23:07 
AnswerRe: Check Remote Computer Windows Services Pin
Richard Deeming22-Oct-15 2:48
mveRichard Deeming22-Oct-15 2:48 

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.