JSON deserialization of open source libraries under iOS
Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size:18px">JSON strings are deserialized into objects under iOS and are common in formal projects. Here are a few common open source libraries that can be selected according to your preferences:</span></p></p><p><p><span style="font-size:18px">1. Jsonmodel:https://github.com/icanzilb/jsonmodel</span></p></p><p><p><span style="font-size:18px">2. mjextension:https://github.com/codermjlee/mjextension</span></p></p><p><p><span style="font-size:18px">3. <span style="font-size:18px">mantle: </span>https://github.com/Mantle/Mantle</span></p></p><p><p><span style="font-size:18px"><br></span></p></p><p><p><span style="font-size:18px">where<span style="font-size:18px">Jsonmodel array elements are deserialized, you need to define a @protocol that is the same as the class name of the element model</span></span></p></p><p><p><span style="font-size:18px"><span style="font-size:18px"></span></span></p></p><pre name="code" class="javascript"><pre name="code" class="javascript">{ "order_id": 104, "total_price": 103.45, "products": [ { "id": "123", "name": "Product #1", "price": 12.95 }, { "id": "137", "name": "Product #2", "price": 82.95 } ]}</pre></pre><br><pre name="code" class="objc"><pre name="code" class="objc">@protocol productmodel@end@interface productmodel:jsonmodel@property (assign, nonatomic) int id; @property (strong, Nonatomic) nsstring* name; @property (assign, nonatomic) float price; @end @implementation productmodel@end@interface Ordermodel:jsonmodel@property (assign, Nonatomic) int order_id; @property (assign, nonatomic) float total_price;@ Property (strong, Nonatomic) nsarray<productmodel, convertondemand>* products; @end @implementation Ordermodel@end</pre></pre><p><p></p></p><p><p><span style="font-size:18px"><span style="font-size:18px"><br></span></span></p></p><p><p><span style="font-size:18px"><span style="font-size:18px"><span style="font-size:18px">mjextension</span> is known as "the World's fastest conversion, using the simplest and most convenient dictionary to model framework", interested can see the specific instructions under Github.<br></span></span></p></p><p><p><span style="font-size:18px"><span style="font-size:18px"><br></span></span></p></p><p><p><span style="font-size:18px"><span style="font-size:18px"><br></span></span></p></p><p><p>JSON deserialization of open source libraries under iOS</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service