Skip to content

Latest commit

 

History

History
128 lines (103 loc) · 3.95 KB

README.md

File metadata and controls

128 lines (103 loc) · 3.95 KB

logo-v2-64-vs JsonButler-IDE

github-release github-dls

JsonButler-IDE lets you use JsonButler's features inside your Visual Studio environment, along with some additional features.

  • Generate C# types from JSON snippets/files.
  • Serialize C# types to JSON text, from within Visual Studio (project does not need to be running).
  • Easily change cases of phrases (to camelCase, lower_snake_case, PascalCase, and _underscoreCamelCase).
  • More features coming soon!

Generate C# types from JSON snippets/files.

Convert your JSON snippets easily into C# types usable in code.
For example:
json-source
automatically generates:

namespace Andeart.CustomPayloads
{
    public class MyNewPayload
    {
        [JsonProperty ("name")]
        public string Name { get; private set; }

        [JsonProperty ("lines")]
        public string[] Lines { get; private set; }

        [JsonProperty ("winning_number")]
        public int WinningNumber { get; private set; }

        [JsonProperty ("new_type")]
        public NewType NewType { get; private set; }

        [JsonConstructor]
        private MyNewPayload (string name, string[] lines, int winningNumber, NewType newType)
        {
            Name = name;
            Lines = lines;
            WinningNumber = winningNumber;
            NewType = newType;
        }
    }

    public class NewType
    {
        [JsonProperty ("nested_type")]
        public NestedType NestedType { get; private set; }

        [JsonConstructor]
        private NewType (NestedType nestedType)
        {
            NestedType = nestedType;
        }
    }

    public class NestedType
    {
        [JsonProperty ("id")]
        public float Id { get; private set; }

        [JsonConstructor]
        private NestedType (float id)
        {
            Id = id;
        }
    }
}

Serialize C# types to JSON text, from within Visual Studio

Convert your C# payload types into JSON, using default values as needed.
For example:

public class HandleMaterial
{
    public int MaterialName { get; }

    public HandleMaterial (int materialName)
    {
        MaterialName = materialName;
    }
}


public class HandleData
{
    public float Strength { get; }

    public HandleMaterial Material { get; }

    [JsonIgnore]
    public Handle Handle { get; private set; }

    public HandleData (float strength, HandleMaterial material)
    {
        Strength = strength;
        Material = material;
    }
}

can be converted via the right-click context menu, ser-cs to automatically generate this JSON snippet:

{
  "strength": 0.0,
  "material": {
    "material_name": 0
  }
}

Installation and Usage

Download the JsonButlerIde.vsix file from the Github releases page.
Install the Visual Studio extension by running the .vsix file.
This may also open up a dialog box that lets you choose which Visual Studio version you want to install this extension into.

Coming soon (maybe): A direct download from the Visual Studio Marketplace.

Feedback and Contribution

Please feel free to send in a Pull Request, or drop me an email. Cheers!