title: Storing a Key Value Array into a compact JSON string
body: <p>I want to store an array of key value items, a common way to do this could be something like:</p>
  
  <pre><code>// the JSON data may store several data types, not just key value lists,
  // but, must be able to identify some data as a key value list
  
  // --&gt; more "common" way to store a key value array
  {
    [
      {"key": "slide0001.html", "value": "Looking Ahead"},
      {"key": "slide0008.html", "value": "Forecast"},
      {"key": "slide0021.html", "value": "Summary"},
      // another THOUSANDS KEY VALUE PAIRS
      // ...
    ],
    "otherdata" : { "one": "1", "two": "2", "three": "3" }
  }
  </code></pre>
  
  <p>But, when there is many pairs / items, the string length becomes prohibited,
  and I want a compact way, this could be an example:</p>
  
  <pre><code>// --&gt; (1) a "compact" way to store a key value array
  {    
    [
        {"slide0001.html", "Looking Ahead"},
        {"slide0008.html", "Forecast"},
        {"slide0021.html", "Summary"},
        // another THOUSANDS KEY VALUE PAIRS
        // ...
    ],
    "otherdata" : { "one": "1", "two": "2", "three": "3" }
  }
  </code></pre>
  
  <p>Additionally, I want a way to identify the data as a keyvalue array,
  because, I may want to store other data in the same JSON file.
  I have these examples:</p>
  
  <pre><code>// --&gt; (2) a "compact" way to store a key value array    
  {
      "keyvaluelist":
      [
        {"slide0001.html", "Looking Ahead"},
        {"slide0008.html", "Forecast"},
        {"slide0021.html", "Summary"},
        // another THOUSANDS KEY VALUE PAIRS
        // ...
      ],
      "otherdata" : { "one": "1", "two": "2", "three": "3" }
  }
  
  // --&gt; (3) a "compact" way to store a key value array    
  {
      "mylist":
      {
        "type": "keyvaluearray",
    "data":
      [
          {"slide0001.html", "Looking Ahead"},
          {"slide0008.html", "Forecast"},
          {"slide0021.html", "Summary"},
                      // another THOUSANDS KEY VALUE PAIRS
                      // ...
      ]
      },
      "otherdata" : { "one": "1", "two": "2", "three": "3" }
  }
  </code></pre>
  
  <p>What do you thing, which one do you suggest, do you have another way ?
  Thanks.</p>
  
  <p>UPDATE 1: Remove invalid code. Javascript => JSON</p>
  
  <p>UPDATE 2: Add non key value data</p>
  
  <p>UPDATE 3: Replace "[" and "]" for "{" and "}" in each key value pair</p>