title: Designing mutually exclusive parameter groups in JSON
body: <p>I have a set of two unrelated parameter groupings in JSON which are mutually exclusive. The decision as to which parameter group should remain in the JSON file is driven by one other parameter. </p>
  
  <p>I'm unsure as to whether this should really be handled by using this particular structure, or indeed if it even falls under best practice. </p>
  
  <p>In the first case we have a contract that is of type <code>Fixed</code> which has two parameters specific to it <code>fixedEnd</code> and <code>fixedEndUnit</code>. </p>
  
  <p>In the second case we have a contract that is of type <code>Variable</code> which has just a single parameter specific to it <code>variableEnd</code>.</p>
  
  <p>A contract can only ever be either Fixed or Variable. And, both of these contract types have common values <code>foo</code>, <code>bar</code> and <code>baz</code>.</p>
  
  <p>How should I structure my JSON</p>
  
  <p><strong>First Case</strong></p>
  
  <pre><code>    "contract":[
        {
          "type":"Fixed",
          "fixedEnd":12,
          "fixedEndUnit":"Months",
          "foo":"foo",
          "bar":"bar",
          "baz":"baz"
        }]
  </code></pre>
  
  <p><strong>Second Case</strong></p>
  
  <pre><code>    "contract":[
        {
          "type":"Variable",
          "variableEnd":"2012-03-19T07:22Z",
          "foo":"foo",
          "bar":"bar",
          "baz":"baz"
        }]
  </code></pre>