title: Parsing JSON into TListBox
body: <p>Good evening guys!</p>
  
  <p>I'm currently trying to put together a <code>CloudFlare</code> client for the desktop. I've connected to their API and successfully retrieved the JSON results with a POST request (the results of which have been output into a <code>TMemo</code>). I'm now wanting to parse these results into a <code>TListBox</code> (see bolded area for example). The project is being designed in <code>Firemonkey</code>.</p>
  
  <p>Here's the formatted layout of the response with some example content;</p>
  
  <pre><code>{
   - response: {
     |- ips: [
        |- {
           ip: "xxx.xxx.xxx.xxx",
           classification: "threat",
           hits: xx,
           latitude: null,
           longitude: null,
           zone_name: "domain-example1"
           },
         - {
           ip: "yyy.yyy.yyy.yyy",
           classification: "robot",
           hits: yy,
           latitude: null,
           longitude: null,
           zone_name: "domain-example2"
           }
         ]
     }
    result : "success",
    msg: null
  }
  </code></pre>
  
  <p>I've tried several different components - <a href="http://code.google.com/p/superobject">SuperObject</a>, <a href="http://edn.embarcadero.com/article/40882">Paweł Głowacki's JSON Designtime Parser</a>, <a href="http://code.google.com/p/tiny-json/">Tiny-JSON</a>, <a href="http://lkjson.sourceforge.net">LKJSON</a> and the built in DBXJSON. However, i've no experience with JSON at all and i can't seem to find the most basic of examples that i can get started from. Many of them show sample data, but all the ones i've tried don't seem to work as i'd expect, most likely because i'm misunderstanding them. I'd assume the components work, so i need guidance on getting started.</p>
  
  <p>There are hundreds, often thousands, of results in the <code>ips</code> "array" (i apologise if that's not correct, i'd assume it's known as an array but again, i'm completely new to JSON).</p>
  
  <p>What i'm really looking for is some sort of extremely basic sample code which i can build from (along with what component it uses for parsing and such).</p>
  
  <p><strong>For example, if i wanted to grab every <code>ip</code> from the JSON results, and put each one as a separate item into a <code>TListBox</code> (using <code>TListBox.add</code> method), how would i go about achieving this?</strong></p>
  
  <p>When i say <code>ip</code>, i mean the value (in the formatted layout above, this would be <code>xxx.xxx.xxx.xxx</code> or <code>yyy.yyy.yyy.yyy</code>).</p>
  
  <p>Additionally, if i wanted to find a "record" (?) by it's IP from the JSON results and output the data to a delphi array - e.g.;</p>
  
  <pre><code>Result : Array of String = ['"xxx.xxx.xxx.xxx"','"threat"','xx','null','null','"domain-example1"'];
  </code></pre>
  
  <p>is that possible with JSON? (If this is seen as a separate question or too unrelated, please feel free to edit it out rather than close the question as a whole).</p>
  
  <p>The closest i got to this had not only the ip's, but every other piece of data in a seperate <code>TListItem</code> (i.e. <code>response</code>, <code>ips</code>, <code>ip</code>, <code>classification</code>, <code>xxx.xxx.xxx.xxx</code> and everything else had it's own item, along with several empty items in between each non-empty item).</p>
  
  <p>I'm sure it's extremely simple to do, but there's so much information on JSON that it's a little overwhelming for people new to the format.</p>
  
  <p>Best Regards,
  Scott Pritchard.</p>