title: Flot - Importing multi-series data from JSON
body: <p>I'm having trouble getting to grips with using a JSON file to populate my chart. At the moment, my function has a section that manually sets my dataset variable, e.g.:</p>
  
  <pre><code>var datasets2 = {
  "01": {
      label: "Group 1",
      data: [[1391385600000, 98],[1392249600000, 99],[1393113600000, 98]]
  },   
  "02": {
      label: "Group 2",
      data: [[1391385600000, 98],[1392249600000, 98],[1393113600000, 97]]
  }, 
  "03": {
      label: "Group 3",
      data: [[1392249600000, 96],[1393113600000, 96]]
  },
  "04": {
      label: "Group 4",
      data: [[1391385600000, 89],[1392249600000, 93],[1393113600000, 90]]
  },
  };
  </code></pre>
  
  <p>This work fine. What I'd like to do is replace this with something like:</p>
  
  <pre><code>var datasets2 = .getJSON('example.json');
  </code></pre>
  
  <p>I know the code isn't as simple as that and I'm currently looking at how I could parse the entire JSON file as a string into datasets2 so that it works as normal. If anyone wants to know why the data is formatted that way, it's because I'm working on the toggle-series example provided with Flot.</p>
  
  <p>Thanks!</p>
  
  <p>EDIT</p>
  
  <p>Thanks for feedback so far. I've tried using the command as per the answer below but still nothing. I'm wondering if the format of JSON file is out? I've formatted as per instructed by Flot but now I'm not so sure...</p>
  
  <pre><code>{ 
    "001": [ 
  { 
    "label": "first set", 
    "data": [ 
      [1391385600000, 98], 
      [1392249600000, 99], 
      [1393113600000, 98]
    ] 
  }, 
    ],
    "002": [ 
  { 
    "label": "second set", 
    "data": [ 
      [1391385600000, 96], 
      [1392249600000, 95], 
      [1393113600000, 98]
    ] 
  } 
  ]
  } 
  </code></pre>