jeet jeet - 1 year ago 64
JSON Question

Quick and Easy Deserialization and To Text JSON

So I have a big JSON file with lists and stuff that looks like this: link

I have also devised the necessary classes using

My problem is, I need to output the whole data into a

. I just need the text representation of this data.

I can obviously call each member, loop through al the list and manage their textual representation, but is there a quick and dirty way to just output the string? I am using


EDIT: I know how to do it using .net objeccts as given here:

I was looking for a one go method.

Answer Source

You can serialize a graph of objects as long as you have the right data structures. For example, you can see how the Bar objects are created as an array of objects:

public class Foo {

    private List<Bar> names;
    private string name;

    public Foo() { = "Name";
        this.names = new List<Bar>() {
            new Bar("a"),
            new Bar("b"),
            new Bar("c")

    public string Name {
        get {

    public List<Bar> Names {
        get {
            return this.names;

public class Bar {
    public Bar(string name) {
        this.Name = name;

    public string Name {
        private set;

var o = new Foo();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download