Skip to content

Instantly share code, notes, and snippets.

@IgorKarymov
Created February 11, 2012 07:13
Show Gist options
  • Save IgorKarymov/1797406 to your computer and use it in GitHub Desktop.
Save IgorKarymov/1797406 to your computer and use it in GitHub Desktop.
validator
Validators = [
{<<"count">>, {integer, [{min, 1}, {optional, 20}]}},
{<<"enabled">>, {boolean, []}}
],
{ok, [Count, Enabled]} =
validator:validate_json(JsonData, Validators, #val_opts{throw = true,
acc_type = values
}).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment