Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.21 KB

README.md

File metadata and controls

36 lines (24 loc) · 1.21 KB

SmallJSONParser

Carthage compatible

A lightweight and small JSON parser for Swift.

Based on "Dynamic Member Lookup" Types.Learn more here Introduce User-defined "Dynamic Member Lookup" Types.

let string = "{\"id\": 923, \"name\": \"hello\", \"coord\":{\"lon\": 116.4, \"lat\": 39.91}}"
let json = JSON.parse(string)
let id = json.id.intValue    //   923
let name: String = json.name    //   hello
let lon: Double = json.coord.lon    //  116.4

Requirements

  • Swift 4.2 or later

Installation

  • Insert github "chn-lyzhi/SmallJSONParser" to your Cartfile.
  • Run carthage update.
  • Link your app with SmallJSONParser.framework in Carthage/Build.

(coming soon)

  • Insert pod 'SmallJSONParser' to your Podfile.
  • Run pod install.