dwarvesf / til

Today I Learned. Our knowledge hub. List out what we've learned everyday, organized.
29 stars 1 forks source link

How to quick create Object from JSON #28

Open viettrungphan opened 6 years ago

viettrungphan commented 6 years ago

Today, I going to introduce a quick method to create our custom object from JSON.

All we need to do is:

  1. Install VSCode if you didn't have one.
  2. Install VSCode Paste JSON as Code Extension

To install VS code on MAC OS your can run brew cask install visual-studio-code or quick search how to install on Google.

Open VS code, Click on Extension and search for Parste JSON and Install it.

screen shot 2018-07-23 at 10 04 55

Now you need quit and reopen your VSCode. Create new JSONFile with .json extension Press Command + Shift + P to open menu

screen shot 2018-07-23 at 10 10 08

Choose Open Quick type for JSON Press Command + Shift + P again to set quick type target language I'm using Swift so I choose Swift Now you can see JSON convert to your target language

screen shot 2018-07-23 at 10 16 55

Now simple copy your object to use.