VS Quick generate JSON data format corresponding entity

Source: Internet
Author: User

Have a fixed JSON data format, do you still manually tap the corresponding entity? It's a little low! To get to the point, this is a JSON string, first to verify that the JSON data format (http://www.bejson.com/) is as follows:

{    "Items_custom_get_response": {        "Items": {            "Item": [                {                    "num_iid":1,                    "product_id":0,                    "SKUs": [                        {                            "created":NULL,                            "Modified":NULL,                            "outer_id":NULL,                            " Price":NULL,                            "Properties":NULL,                            "Properties_name":"Black",                            "Quantity":"2",                            "sku_id":NULL                        }                    ]                }            ]        }    }}

If you need to use it, be sure to deserialize it, serialize it to the entity, and structure it as follows (in general you will be handwritten, except for the Great God):

 Public classRootobject { PublicItems_custom_get_response Items_custom_get_response {Get;Set; } }          Public classItems_custom_get_response { PublicItems {Get;Set; } }          Public classItems { PublicList<item> Item {Get;Set; } }          Public classItem { Public intNUM_IID {Get;Set; }  Public intproduct_id {Get;Set; }  PublicList<sku> SKUs {Get;Set; } }          Public classSku { Public ObjectCreated {Get;Set; }  Public ObjectModified {Get;Set; }  Public Objectouter_id {Get;Set; }  Public ObjectPrice {Get;Set; }  Public ObjectProperties {Get;Set; }  Public stringProperties_name {Get;Set; }  Public stringQuantity {Get;Set; }  Public Objectsku_id {Get;Set; } }

Do you feel like you're in the mist when you finish writing this?

Landlord to you recommend a rapid generation method, using VS2013 or 2015, as if VS2012 this does not support! How to quickly generate corresponding entities?         Copy the JSON string and choose to paste the JSON as a class. The following file is then generated in the class file:
 Public classRootobject { PublicItems_custom_get_response Items_custom_get_response {Get;Set; } }          Public classItems_custom_get_response { PublicItems {Get;Set; } }          Public classItems { PublicItem[] Item {Get;Set; } }          Public classItem { Public intNUM_IID {Get;Set; }  Public intproduct_id {Get;Set; }  PublicSku[] SKUs {Get;Set; } }          Public classSku { Public ObjectCreated {Get;Set; }  Public ObjectModified {Get;Set; }  Public Objectouter_id {Get;Set; }  Public ObjectPrice {Get;Set; }  Public ObjectProperties {Get;Set; }  Public stringProperties_name {Get;Set; }  Public stringQuantity {Get;Set; }  Public Objectsku_id {Get;Set; } }

It may be a little different from what you define, what is the difference between an object array and a generic list?

Arrays have many advantages, for example, arrays are stored continuously in memory, so its index speed is very fast, and the assignment and modification elements are simple; ArrayList is a specialized class provided by the. Net Framework for data storage and retrieval. It is part of the namespace System.Collections. Its size is dynamically expanded and shrunk according to the data stored in it. Therefore, we do not need to specify the length of the ArrayList object when declaring it. ArrayList inherits the IList interface, so it makes it easy to add, insert, and remove data, because ArrayList has the disadvantage of unsafe types and packing unboxing, so the concept of generics occurs after c#2.0. The list class is a generic equivalent class of the ArrayList class. Most of its usage is similar to ArrayList, because the list class inherits the IList interface as well.      The key difference is that when declaring a list collection, we also need to declare the object type for the data in the list collection. The machine is loaded with 12, 13, 15,VS2015 's powerful features are still in the exploration .....    From: http://www.cnblogs.com/viaiu/p/5007644.html

VS Quick generate JSON data format corresponding entity

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.