DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.87k stars 1.44k forks source link

More Converters csv2json, json2csharp, xml2charp, etc. #1220

Open agravity-philipp opened 3 months ago

agravity-philipp commented 3 months ago

What feature or new tool do you think should be added to DevToys?

I want to have more convers like these: https://json2csharp.com/code-converters/xml-to-csharp

Why do you think this is needed?

Because I need them and there are a lot of them on the internet. And I want to have it in my "army knife".

Solution/Idea

Auto-Detect would be nice. So I just have to set the format I want to have it converted. A big textbox on the left and a big textbox on the right. Above there is a dropdown of supported languages.

Comments

No response

cloudfy commented 3 months ago

We've added https://www.nuget.org/packages/DevToys.JsonToCsharp initial release 1.0.5 to DevToys 2.0.1. Happy to take feature requests and more inputs.

veler commented 3 months ago

We've added https://www.nuget.org/packages/DevToys.JsonToCsharp initial release 1.0.5 to DevToys 2.0.1. Happy to take feature requests and more inputs.

Hi @cloudfy , this is awesome! I tested it and it works great so far !

image

One advice:

You can colorize the JSON and C# text automatically by using the Language method on the MultilineTextInput.

Example:

MultiLineTextInput()
                        .Title("JSON editor")
                        .Language("json");

This will colorize the code like this:

image

cloudfy commented 3 months ago

Amazing, added to 1.0.7. Just released :) - you may close the topic.

veler commented 3 months ago

Awesome! Thanks ! Well, this topic mentions other things than Json to C#, but I see your point.

By the way, how about supporting Smart Detection in your tool? https://devtoys.app/doc/articles/extension-development/guidelines/UX/support-smart-detection.html In your case, I believe all you need to do is adding [AcceptedDataTypeName(PredefinedCommonDataTypeNames.Json)] to your IGuiTool. The intercept the data and place it in the input text box, like this:

https://github.com/DevToys-app/DevToys.Tools/blob/59bda4213ea21e5f8f40259ddec7579d9ad363d1/src/DevToys.Tools/Tools/Formatters/Json/JsonFormatterGuiTool.cs#L125C1-L133C6