JSON data format
1. Overview:
JSON (JavaScript Object Notation) is a lightweight data interchange format
Based on the text format, easy to read and write, but also easy to machine analysis and build.
2. The format of the JSON data is: name/value • The name is written in the front face (in double quotes)
• Value pairs are written on the back face
• Middle? Separated by a colon
3. JSON value? Type of support
Number (integer or floating point)
String (in double quotes)
Logical value (TRUE or FALSE)
Array (in brackets)
Object (in curly braces)
Null
JSON format? One: The outermost is? curly braces
Online JSON format? Tool http://json.phpddt.com
Url:
Http://api.openweathermap.org/data/2.5/weather?q=beijing&units=metric
JSON format? Two: The outermost is the middle bracket
1. JSON value? The correspondence between the supported types and OC objects
XML data format
1. XML (extensible Markup Language) Extensible Markup Word,
• Is it a type of marker that is used to mark the electrical sub-document so that it has a structured markup language?
XML is a common language used in the transfer of data between various applications.
2. Three terms for XML documents:
root element: Outermost element
Element: From the start tag until the end of the label's section
Attribute (Attribute): Provides additional information about the element
1. XML sample?:
2. XML sample? Two:
1. XML parsing? Mode:
DOM:? Load the entire XML document into memory at once, through the element structure within the XML document, parse out the element pair
Expected value/attribute
SAX: Starting with the root element of the XML document, parsing the elements sequentially
2. Parsing XML in iOS? Document CLASS/Library
Gdataxml:dom analysis, developed by Google, based on LIBXML2
Nsxmlparser:sax the method of analysis, making it relatively simple
3. Example: Parsing XML with gdataxml? Documents and configurations:
A. gdataxml/folder guide into Xcode project
B. "Header Search Paths" in Build setting add/usr/include/libxml2c. "Other Linker Flags" in Build setting add-LXML2
Parsing Xml/json in iOS