DEV Community

Cover image for The Most Underrated Tools Every Developer Must Know: Part 2
Ravina Deogadkar
Ravina Deogadkar

Posted on • Edited on

The Most Underrated Tools Every Developer Must Know: Part 2

Hi everyone! Hope everything is well at your end. In my last part I have discussed about some of online tools for json converter to POJO classes. If you have not read it earlier you can find the link here .

Last time I have mentioned online tools today I am going to mention visual studio hacks and VS code extension to accomplish same task.

VS code extension

Json to JS convertor

What : This VS code extension converts JSON string into JS object.
How : Select JSON string and press Ctrl + Shift + J or press Ctrl + Shift + P and type Convert JSON into JS object.

JSON to JS extension

JSON to JS object

What : This VS code extension converts JSON string to JS object. It converts snake case keys to camel case keys while converting to object.
How : Select JSON string and press Ctrl + Shift + P and type JSON to JS object.

JSON to JS Object extension

Visual Studio

You can convert JSON string to C# POJO objects using an easy Visual studio hack.
What: Visual Studio provides a paste special option to convert JSON strings into C# POJO classes.
How: Copy JSON string and in visual studio open project or solution and then in Edit tab -> select Paste Special -> Paste JSON as Object.

Visual Studio Paste Special

Sample JSON string



{
  "student": {
    "name": "Test",
    "degree": "IT",
    "subjects": [{
        "name" : "Computer Science",
        "mark": 95
    },
    {
        "name" : "Maths",
        "mark": 98
    }]
  }
}


Enter fullscreen mode Exit fullscreen mode

And then once you click on Paste JSON as Object menu, the above JSON object is converted into class and pasted as classes in the file.



namespace ClassLibrary1
{
public class Rootobject
{
public Student student { get; set; }
}

public class Student
{
    public string name { get; set; }
    public string degree { get; set; }
    public Subject[] subjects { get; set; }
}

public class Subject
{
    public string name { get; set; }
    public int mark { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

}

Enter fullscreen mode Exit fullscreen mode




Visual Studio Tool

JSON to C# tool

What : This tool will convert JSON string to C# classes and also add JSONProperty Attribute to represent property when they are serialized to JSON.
How : Install JSON to C# tool and then from Tools menu -> JSON to C# menu -> Paste JSON string -> Generate
OR Copy Json data -> right click on project folder and Generate classes from JSON.

JSON to C# budget tool

That's all for today, Stay tuned for next time when I will discuss tools for JSON validation.

Happy Coding!...

Top comments (2)

Collapse
 
frankfont profile image
Frank Font

Nice! I will have to check that one out next time I'm crafting some jsons to consume in javascript.

Collapse
 
deogadkarravina profile image
Ravina Deogadkar

Thank you!..