Skip to content

dkmar/pasteJSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: if you actually need this utility, use a more proven tool like quicktype

Summary

I threw this utility together to emulate the Paste JSON as Classes feature of Visual Studio.

Given either a file containing JSON or a JSON object on stdin, this program maps the JSON structure to C# classes and prints their class declarations.

USAGE: pasteJSON [file]

FLAGS: -h, --help Prints help information -V, --version Prints version information

ARGS: The file containing the JSON object

EXAMPLE USAGE:

    (1)   pasteJSON weather.json
    
    (2)   cat weather.json | pasteJSON

Example Results

{
  "menu": {
    "header": "SVG Viewer",
    "items": [
      {
        "id": "Open",
        "label": "Open"
      },
      {
        "id": "OpenNew",
        "label": "Open New"
      }
    ]
  }
}

-->

public class Root
{
    public Menu menu { get; set; }
}

public class Menu
{
    public string header { get; set; }
    public Items[] items { get; set; }
}

public class Items
{
    public string id { get; set; }
    public string label { get; set; }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published