ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

JSON2​Apex

by nchursin ST3

A Sublime Text 3 plugin for easy conversion of JSON samples to Salesforce Apex code.

Details

Installs

  • Total 2K
  • Win 1K
  • Mac 512
  • Linux 147
Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16
Windows 0 0 0 1 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
Mac 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
01234Apr 1Mar 29Mar 26Mar 23Mar 20Mar 17Mar 14Mar 11Mar 8Mar 5Mar 2Feb 27Feb 24Feb 21Feb 18Apr 1 Linux: 0 Mac: 1 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 0Mar 25 Linux: 0 Mac: 0 Windows: 2Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 0 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 1 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 0Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 1 Windows: 0Feb 28 Linux: 0 Mac: 1 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 1 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 0Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 1 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0Apr 1 Linux: 0 Mac: 1 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 0Mar 25 Linux: 0 Mac: 0 Windows: 2Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 0 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 1 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 0Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 1 Windows: 0Feb 28 Linux: 0 Mac: 1 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 1 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 0Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 1 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0Apr 1 Linux: 0 Mac: 1 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 0Mar 25 Linux: 0 Mac: 0 Windows: 2Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 1 Windows: 0Mar 18 Linux: 0 Mac: 0 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 1 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 0Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 1 Windows: 0Feb 28 Linux: 0 Mac: 1 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 1 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 0Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 0Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 1 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 1 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0

Readme

Source
raw.​githubusercontent.​com

JSON2Apex

A Sublime Text 3 plugin to generate Salesforce Apex classes from JSON samples.

Description

A tool to generate Apex code from JSON. You can use it to generate an Apex class either from a API resposne/request sample or from predefined schema.

Requirements

  1. Sublime Text 3
  2. MavensMate is highly recommended. This plugin uses MM's Apex syntax highlight.

Since MavensMate requires ST 3, there will be no ST 2 support.

Installation

Via Package Control

Install Package Control if you don't have it.

  1. Run Install Package
  2. Search for JSON2Apex
  3. Press Enter

Manual

  1. Clone this repo to your Sublime Packages folder. To find it go to Preferences -> Browse Packages (Sublime Text -> Preferences -> Browse Packages on Mac).
  2. Restart Sublime if needed.

How to use it

Generate class from JSON API request/response sample

  1. Get a JSON response or request sample
  2. Open it in Sublime Text 3
  3. Using Ctrl+Shit+P (or ⌘+Shift+P on Mac) find JSON2Apex: Convert sample to Apex
  4. Press Enter
  5. You will see generated Apex code. Also a text input appears at the bottom of the buffer. Use this input to change generated class names quickly.

Generate class from JSON or YAML schema

JSON sample schema can be found here YAML sample schema can be found here

  1. Create a schema.
  2. Use JSON2Apex: Convert JSON schema to Apex (JSON2Apex: Convert YAML schema to Apex for YAML schemas) command. (Ctrl+Shit+P (or ⌘+Shift+P on Mac) to find it)
  3. Rename the class either manually or using a text input at the bottom of the buffer.

After renaming is over Sublime will select all the generated code for you to copy it anywhere you want.

Future plans

  1. Swagger JSON to Apex REST Definition generation.

License

Apache 2.0 except for pyyaml.