DEV Community

João Osório
João Osório

Posted on

2 2

Automatic class creation for unmarshalling JSON

If you're working with JSON, say for REST web services, and you don't have the class to unmarshal the response, Visual Studio can automatically generate the class for you:

  1. Open your Visual Studio Project and create a class file. Delete the contents: Class creation
  2. Copy the JSON text string you will need to unmarshal onto the clipboard. Take this example from the JSON Placeholder mock API:
{
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
}
Enter fullscreen mode Exit fullscreen mode
  1. Go to Edit > Paste Special > Paste JSON as Classes: Paste Special The result is a class named "Rootobject" that you can use to unmarshal the information on your code.

Original post is here.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay