netthreads.co.uk - netthreads

Example domain paragraphs

Okay so I wrote this blog post to help others who might be frustrated by the lack of real-world examples of parsing JSON with Swift 2. There are quite a few examples on the net you can find but (so far in my search at least) they are all way too simple to be useful when faced with some JSON with multiple levels of nested data.

Here is some JSON I downloaded from the Glasgow Smart City Car Park occupancy feed here .

{ "version":"1.0", "encoding":"UTF-8", "d2lm$d2LogicalModel":{ "@xmlns$d2lm":"http://datex2.eu/schema/1_0/1_0", "@xmlns$xsi":"http://www.w3.org/2001/XMLSchema-instance", "@xmlns$xalan":"http://xml.apache.org/xslt", "@xmlns$java":"http://xml.apache.org/xalan/java", "@modelBaseVersion":"1.0", "@xsi$schemaLocation":"http://datex2.eu/schema/1_0/1_0 http://datex2.eu/schema/1_0/1_0/DATEXIISchema_1_0_1_0.xsd", "d2lm$exchange":{ "d2lm$supplierIdentification":{ "d2lm$country":"gb", "d2lm$nationalIdentifier":"TIH Too