简体   繁体   中英

how can i decode this page using C#

this is the page url :http://product.dangdang.com/callback.php?type=detail&product_id=20945731&page_type=book

i downloaded the source as a stream or a file . how can i decode it using c# stream ? and get content of the json .

thanks !

I would suggest you to try this json-c#-class-generator , so you can pass this stream to initialize the object tree and then just consume it. I have tried it with a HUGE json, and everything went great!!!!!!

EDIT: You wont even have to pass this Stream object, you may pass the JSON raw string, and youll have the job done!!! see;

public List<Result> HandleRequest(String json)
{
        RootObject ro = new RootObject(json); //This line solved the problem, as now it become totally easy to consume this JSON as C# objects...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM