dotnet / dotnet/vscode-csharp

[SUGGESTION] Support for paste JSON/XML as classes

Open
#7,644 1 comment 0 reactions 1 assignee Claimed by @mikadumont View on GitHub
Feature Request Triaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

Originally filed at https://github.com/microsoft/vscode-dotnettools/issues/1038

Following discussion with @arkalyanms and @webreidi at MVP Summit, one feature I feel is missing from C# Dev Kit in VS Code is the "paste JSON/XML as classes" feature from Visual Studio.

This allows you to copy a JSON or XML object, and via the "Paste Special" menu paste it as a C# class with the relevant types created / matched ([See here](https://learn.microsoft.com/en-us/visualstudio/ide/reference/paste-json-xml?view=vs-2022))

It is a hugely helpful feature when creating integrations with APIs: copy sample from docs -> paste into Visual Studio -> C# class representing the object(s) automatically created.

The Visual Studio implementation is certainly not perfect, e.g. I wish it would keep properties pascal case, or automatically apply `System.Text.Json` serialization attributes where relevant, but it definitely speeds things up!

In VS Code I imagine this could appear in the Edit menu, or as an option on right-click when within a `.cs` file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.