Background Color:
Background Pattern:
Monday, April 23, 2018
menu click

JSONSchema2NetEnum VSIX extenstion

This VS2017 Extension provides a quick way to convert JSON Schema based Enums to their equivalent C# Net counterparts.

You can download it here or through the VS2017 Extensions manger

While most tools like Newtonsoft will also do this, they stumble on Enums that have string values and a separate EnumNames list. In this case most tools just provide the Enum string value as both the value and enum name ignoring the EnumNames list. This is because the JSON consortium has yet to include the EnumNames list in th especifiction even though many organizations are already using this construct.

This tool will properly evaluate the EnumNames list and generate a C# Enum file properly formatted for serialization using NetonSoft's tools.

Install the VSIX package then go to View>Other Windows and select the Jaso2EntEnum window.  Dock it where you want it. 

Open a project that your JSON Enum Schemas are targeting.

Select one or more JSON Enum Schema files to process.

The AutoDerived Namespace, AutoDerived Destination Folder and Auto Save Files should be checked,'

If you select a folder other than the root of the project, then the values shown in the Namespace  and Destination folders should change to reflect your selections.

If you want to edit these values to something else, then uncheck them ad make your changes.

If you want to manually save the files, uncheck the AutoSave checkbox.

Finally, select the Process Selected Files button on the menu and the C# Enum files will be generated.

If you like this add-in and want to donate something to help cover future the button below. Any amount would be appreciated.

Donate through PayPal - it's fast, free and secure!