Newtonsoft.json lightweight, fast and concise entity JSON conversion Library Yeajur.mapper

Source: Internet
Author: User

When using MVC, we often use Newtonsoft.json to convert between entities and JSON, but sometimes there are exceptions to some entities Newtonsoft.json conversions. Yeajur.mapper is to solve these problems, and lighter than Newtonsoft.json, conversion speed, the use of concise, test results are as follows

PK Item

Yeajur.mapper

Newtonsoft.json

Version

1.0

9.0.1

Size

6KB

514KB

Instance (JSON format)

[

{

"Products": [

{

"Id": "7ef9516e-e019-4b54-9636-89fc56b2906f",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223405)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "00293c28-b29a-4e2c-b5a2-6411d8a67d9e",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "42f8157a-0f25-472b-9b15-15bc876abeff",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "24e5b9af-5108-462b-924f-b79bf9c1b160",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "70a3414b-2c76-4417-a47c-4b807301f0f5",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "1990168f-244d-42b8-8276-7ee08e0829a0",

"Name": "Yeajur.mapper",

"Other": null

}

}

],

"Sellerinfo": {

"Id": "31875b3f-970d-4383-9d2f-b769c3e7cc87",

"Name": "Yeajur.mapper",

"Remark": "Yeajur.mapper"

}

},

{

"Products": [

{

"Id": "Cd78b31d-0e83-4586-a202-f45349eabe98",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "E4ade655-22e3-4850-96dc-02f7059479b8",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "20d2219b-d520-4c58-840e-c11b10e8878f",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "3817b018-369a-4413-b0df-cde5a877d0d7",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "B83d5db6-1216-4a56-a448-d5c478a30b32",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "321B2DAD-7D66-42D0-B75D-C019CD297A1B",

"Name": "Yeajur.mapper",

"Other": null

}

}

],

"Sellerinfo": {

"Id": "C7E7F104-3484-4640-9003-AD6DDD5CB3DC",

"Name": "Yeajur.mapper",

"Remark": "Yeajur.mapper"

}

},

{

"Products": [

{

"Id": "1d8c2158-008c-4ad1-8803-915a5e32c695",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "58c89199-c1fc-4c94-8d74-3ee3db5f074b",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "311ca89e-be6c-4bcf-8730-12abb1388319",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "87f3c2ce-d6bd-4cfb-bcf0-9a48615b223c",

"Name": "Yeajur.mapper",

"Other": null

}

},

{

"Id": "5d23505c-206a-4bdc-9086-92532fcf37d7",

"Name": "Yeajur.mapper",

"Count": 32,

"Createtime": "/date (1484796223406)/",

"Price": 12.32,

"Supplierinfo": {

"Id": "e5582774-ca39-43e0-8e78-9511ea96061b",

"Name": "Yeajur.mapper",

"Other": null

}

}

],

"Sellerinfo": {

"Id": "9f1b4e00-bf00-4946-8e8a-a2780c118079",

"Name": "Yeajur.mapper",

"Remark": "Yeajur.mapper"

}

}

]

How to json--the entity to change

var json = model. ToJson ();

var json = JsonConvert. SerializeObject (model);

Example of running result of solid to json--

Solid to json--running average speed

9.4ms (including create entity time)

151.8ms (including create entity time)

JSON to entity--notation

var model = json. tomodel<List<Order>> ();

var model = JsonConvert. Deserializeobject<List<Order>> (JSON);

JSON to entity-example of running results

JSON to entity-run average speed

15.2ms

167.8ms

Search Yeajur.mapper in the project's nuget to download the use

Https://www.nuget.org/packages/YeaJur.Mapper

Newtonsoft.json lightweight, fast and concise entity JSON conversion Library Yeajur.mapper

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.