Skip to content

Instantly share code, notes, and snippets.

@jrfondren
Created October 3, 2019 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrfondren/b40baf90689f96b51d836e0881b0a3f1 to your computer and use it in GitHub Desktop.
Save jrfondren/b40baf90689f96b51d836e0881b0a3f1 to your computer and use it in GitHub Desktop.
jsonizer this error
#! /usr/bin/env dub
/+ dub.sdl:
dependency "jsonizer" version="~>0"
+/
import std.stdio;
import jsonizer;
struct ComponentList
{
mixin JsonizeMe;
enum Type
{
None,
Whitelist,
Blacklist
}
string component;
string[] modules;
}
struct Settings
{
mixin JsonizeMe;
string path;
this(in string path)
{
this.path = path.idup;
}
@jsonize
{
string realName;
string userName;
string nickName;
long saveInterval;
string[] commandPrefixes;
}
@jsonize(Jsonize.opt)
{
ComponentList.Type componentListType;
ComponentList[] components;
}
}
void main() {
Settings x = Settings("hi");
writeJSON!Settings("test.json", x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment