JSON2Apex
A Sublime Text 3 plugin for easy conversion of JSON samples to Salesforce Apex code.
Details
Installs
- Total 2K
- Win 1K
- Mac 517
- Linux 147
May 18 | May 17 | May 16 | May 15 | May 14 | May 13 | May 12 | May 11 | May 10 | May 9 | May 8 | May 7 | May 6 | May 5 | May 4 | May 3 | May 2 | May 1 | Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
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 |
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
- Sublime Text 3
- 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.
- Run
Install Package
- Search for
JSON2Apex
- Press
Enter
Manual
- Clone this repo to your Sublime Packages folder. To find it go to
Preferences -> Browse Packages
(Sublime Text -> Preferences -> Browse Packages
on Mac). - Restart Sublime if needed.
How to use it
Generate class from JSON API request/response sample
- Get a JSON response or request sample
- Open it in Sublime Text 3
- Using
Ctrl+Shit+P
(or⌘+Shift+P
on Mac) findJSON2Apex: Convert sample to Apex
- Press Enter
- 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
- Create a schema.
- 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) - 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
- Swagger JSON to Apex REST Definition generation.
License
Apache 2.0 except for pyyaml.