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 702
  • Win 490
  • OS X 157
  • Linux 55
Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4
Windows 0 2 3 0 1 0 2 1 1 2 0 0 1 3 1 2 2 0 0 4 0 0 2 1 1 1 2 0 1 0 1 1 0 0 2 2 9 1 0 1 1 1 0 4 1
OS X 0 1 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 1 1 1 0 2 2 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 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.