JSON deserialization of open source libraries under iOS

Source: Internet
Author: User

The JSON string is deserialized into an object under iOS. It's more common in formal projects. For example, the following several often use open source libraries. You can choose one of the following according to your preference:

1.?jsonmodel:?https://github.com/icanzilb/jsonmodel

2.?mjextension:?https://github.com/codermjlee/mjextension

3.? mantle:? Https://github.com/Mantle/Mantle


The Jsonmodel of anarray element is defined by the same @protocol as the class name of the element model.

{  "order_id": 104,  "Total_price": 103.45,  "Products": [    {      "id": "123",      "name": "Product #1",      "Price": 12.95    },    {      "id": "137",      "name": "Product #2",      "price": 82.95    }  ]}

@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


mjextension is known as "the world's fastest conversion, using the simplest and most convenient dictionary to model framework", interested in can see the detailed instructions under GitHub.



JSON deserialization of open source libraries under iOS

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.