module EightBall::Marshallers

A JSON marshaller can convert back and forth between JSON and a list of {EightBall::Feature Features} The JSON produced will be pretty-printed, as it is assumed the output will be written to a file.

When converting from JSON, the top-level JSON element must be an array and its keys must use camel-case; this will be converted to snake-case by EightBall in order to adhere to both JSON and Ruby standards.

Below are some examples of valid JSON:

@example A single {EightBall::Feature} is enabled for accounts 1-5 as well as region Europe

[{
  "name": "Feature1",
  "enabledFor": [{
    "type": "range",
    "parameter": "accountId",
    "min": 1,
    "max": 5
  }, {
    "type": "list",
    "parameter": "regionName",
    "values": ["Europe"]
  }]
}]

@example A single {EightBall::Feature} is disabled completely using the {EightBall::Conditions::Always Always} condition

[{
  "name": "Feature1",
  "disabledFor": [{
    "type": "always"
  }]
}]