Giter Site home page Giter Site logo

JSON to Code about devtoys HOT 9 OPEN

devtoys-app avatar devtoys-app commented on May 13, 2024
JSON to Code

from devtoys.

Comments (9)

itsWindows11 avatar itsWindows11 commented on May 13, 2024 2

Could I work on this?

from devtoys.

nartalex avatar nartalex commented on May 13, 2024 1

Exactly. I see this as a input window for my C# class and (maybe) a JSON constructor where I can pick values I need in my JSON.
I mentioned that because I often test my APIs by Postman and I always struggle with converting my API's input model into JSON especially a large ones.
That initial conversion can be done by Swagger, but Swagger generates model as full as it can be, so I have to manually clean it and that can be very time consuming

from devtoys.

veler avatar veler commented on May 13, 2024

With pleasure!

Some guidance:

  1. Feel free to make your own solution for the conversion, or take example on existing implementation on GitHub. Just be mindful of the license. I'd like to keep DevToys under MIT license, so I'd avoid anything that has a license requiring us to publish DevToys under the same than their.
  2. Keep things simple, for now. I'd prefer shipping a converter with a minimal set of languages and options for it than delivering a lot options right at the beginning. For example, for C#, I think the following options to start should be enough:
    • Should array be treated as [] or List
    • Should properties support nullable values or not
  3. Follow the coding style guidance here: https://github.com/veler/DevToys/blob/main/CONTRIBUTING.md#coding
  4. Let's start with JSON to C# and TypeScript first. Let's see in a future iteration for other languages like Java, Python or C++
  5. Let's support Smart Detection feature. Here is an example: https://github.com/veler/DevToys/blob/d6cf9414110d9fecf4c2c44af8df74074ea1def4/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolProvider.cs#L29-L32
  6. When designing the UI
    • Consider using the monaco editor like in Json Formatter or Json <> Yaml tool.
    • If you need more than 3 options in the UI, consider an expandable one, like in Regex Tester tool
    • Make sure to test the UI in compact mode, maximized window and small (width and height) window side.

Don't hesitate to ask questions here or ping me on Discord :)
Thank you so much for wanting to participate :D

from devtoys.

JaiganeshKumaran avatar JaiganeshKumaran commented on May 13, 2024

Visual Studio already has an option for this under the Edit menu.

from devtoys.

veler avatar veler commented on May 13, 2024

@JaiganeshKumaran , thank you :)
What you're saying is true, but it lacks a few options to define, for example, whether we want PascalCase, camelCase, and more options that we can find on websites online.
We're trying to bring the power of these online service into an offline app, not to limit ourselves to what Visual Studio already does.

from devtoys.

nartalex avatar nartalex commented on May 13, 2024

Hi guys! Is there any chance to see Class to JSON converter? I'd love to use it for API testing

from devtoys.

veler avatar veler commented on May 13, 2024

By Class to Json, to you mean generating mocked JSON value from a class definition?

from devtoys.

itsWindows11 avatar itsWindows11 commented on May 13, 2024

I kinda implemented it with NJsonSchema on a sample console app but the output is messy, still have to port it to the app.

from devtoys.

veler avatar veler commented on May 13, 2024

[December 2022 update]

This could be a potential paid feature for DevToys 2.0.

UX could be as simple as:

Input:
JSON

Output:
TypeScript, Python, Java, C#, PHP, C++, Ruby, Go, Dart, Rust, Swift

Settings:
They would be specific to each output language selected. For example, for C#, we could allow to chose whether a [JSONProperty] attribute should be added.

from devtoys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.