http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 2517|回复: 1

[咨询站长] 这样的JSON串,是不是HttpHelper无法转换

[复制链接]
发表于 2017-3-14 21:12:21 | 显示全部楼层 |阅读模式
[JavaScript] 纯文本查看 复制代码
{"retCode": "0","errMsg": "success","retMsg": {"area":"陕西","effective":"立即","isp":"电信","prix":{"1000":{"ad":"","channelBit":"1,2,4,8","corner":"","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"2","priceList":[{"channel":"2082","coopCP":"","cost":"200","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"200","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":"1"}],"ptype":"","suggest":"","virtual":"1","virtual_ad":"点击价格 用券立减"},"10000":{"ad":"","channelBit":"1,2,4,8","corner":"折扣","default_checked":"","extra":"送5M 赠送于1天内到账","hideExtra":"0","pcOnly":"0","position":"","price":"10","priceList":[{"channel":"2082","coopCP":"","cost":"1000","desc":"送5M,1天内到账,以运营商短信为准","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"1000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"1000","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"1000","productQuality":"","scope":"省内","suggest":"0","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":""}],"ptype":"","suggest":"送5M","virtual":"","virtual_ad":""},"102400":{"ad":"","channelBit":"1,2,4,8","corner":"","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"50","priceList":[{"channel":"2082","coopCP":"","cost":"5000","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"5000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":"1"},{"channel":"2082","coopCP":"","cost":"5000","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"5000","productQuality":"","scope":"省内","suggest":"0","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":"1"}],"ptype":"","suggest":"","virtual":"","virtual_ad":""},"20000":{"ad":"","channelBit":"1,2,4,8","corner":"折扣","default_checked":"","extra":"送10M 赠送于1天内到账","hideExtra":"0","pcOnly":"0","position":"","price":"15","priceList":[{"channel":"2082","coopCP":"","cost":"1500","desc":"送10M,1天内到账,以运营商短信为准","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"1500","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"1500","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"1500","productQuality":"","scope":"省内","suggest":"0","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":""}],"ptype":"","suggest":"送10M","virtual":"","virtual_ad":""},"204800":{"ad":"","channelBit":"1,2,4,8","corner":"","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"70","priceList":[{"channel":"2082","coopCP":"","cost":"10000","desc":"95折季度包,全国可用","effectiveArea":"","effectivePeriod":"js","effectiveTime":"","price":"10000","productQuality":"","scope":"全国","suggest":"0","tips":"90天有效,即时生效","type":"55","virtual":""},{"channel":"2082","coopCP":"","cost":"7000","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"7000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"7000","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"7000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""}],"ptype":"","suggest":"","virtual":"","virtual_ad":""},"3000":{"ad":"","channelBit":"1,2,4,8","corner":"折扣","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"5","priceList":[{"channel":"2082","coopCP":"","cost":"500","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"500","productQuality":"","scope":"全国","suggest":"1","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"500","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"500","productQuality":"","scope":"省内","suggest":"1","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":""}],"ptype":"","suggest":"","virtual":"1","virtual_ad":"点击价格 用券立减"},"307200":{"ad":"","channelBit":"1,2,4,8","corner":"","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"100","priceList":[{"channel":"2082","coopCP":"","cost":"10000","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"10000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"10000","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"10000","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""}],"ptype":"","suggest":"","virtual":"","virtual_ad":""},"5000":{"ad":"","channelBit":"1,2,4,8","corner":"折扣","default_checked":"","extra":"","hideExtra":"0","pcOnly":"0","position":"","price":"7","priceList":[{"channel":"2082","coopCP":"","cost":"700","desc":"","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"700","productQuality":"","scope":"全国","suggest":"0","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"700","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"700","productQuality":"","scope":"省内","suggest":"0","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":""}],"ptype":"","suggest":"","virtual":"1","virtual_ad":"点击价格 用券立减"},"50000":{"ad":"","channelBit":"1,2,4,8","corner":"折扣","default_checked":"","extra":"送30M 赠送于1天内到账","hideExtra":"0","pcOnly":"0","position":"","price":"30","priceList":[{"channel":"2082","coopCP":"","cost":"3000","desc":"送30M,1天内到账","effectiveArea":"","effectivePeriod":"","effectiveTime":"","price":"3000","productQuality":"","scope":"全国","suggest":"1","tips":"月底失效,即时生效","type":"4","virtual":""},{"channel":"2082","coopCP":"","cost":"3000","desc":"","effectiveArea":"sn","effectivePeriod":"","effectiveTime":"","price":"3000","productQuality":"","scope":"省内","suggest":"1","tips":"仅限本省内使用,月底失效,即时生效","type":"61","virtual":""}],"ptype":"","suggest":"","virtual":"","virtual_ad":""}},"scope":"全国","tips":"<li><b>生效时间</b>:充值成功即时生效。</li><li><b>使用范围</b>:支持全国漫游。</li><li><b>使用有效期</b>:充值当月有效。</li>"}
}


[C#] 纯文本查看 复制代码
using System;  
  
namespace SufeiNet  
{  
  
    public class PriceList  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 1000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList2  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 10000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList2> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList3  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 102400  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList3> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList4  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 20000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList4> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList5  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 204800  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList5> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList6  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 3000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList6> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList7  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 307200  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList7> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList8  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 5000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList8> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class PriceList9  
    {  
        public string channel { get; set; }  
        public string coopCP { get; set; }  
        public string cost { get; set; }  
        public string desc { get; set; }  
        public string effectiveArea { get; set; }  
        public string effectivePeriod { get; set; }  
        public string effectiveTime { get; set; }  
        public string price { get; set; }  
        public string productQuality { get; set; }  
        public string scope { get; set; }  
        public string suggest { get; set; }  
        public string tips { get; set; }  
        public string type { get; set; }  
        public string virtual { get; set; }  
    }  
  
    public class 50000  
    {  
        public string ad { get; set; }  
        public string channelBit { get; set; }  
        public string corner { get; set; }  
        public string default_checked { get; set; }  
        public string extra { get; set; }  
        public string hideExtra { get; set; }  
        public string pcOnly { get; set; }  
        public string position { get; set; }  
        public string price { get; set; }  
        public IList<PriceList9> priceList { get; set; }  
        public string ptype { get; set; }  
        public string suggest { get; set; }  
        public string virtual { get; set; }  
        public string virtual_ad { get; set; }  
    }  
  
    public class Prix  
    {  
        public 1000 1000 { get; set; }  
        public 10000 10000 { get; set; }  
        public 102400 102400 { get; set; }  
        public 20000 20000 { get; set; }  
        public 204800 204800 { get; set; }  
        public 3000 3000 { get; set; }  
        public 307200 307200 { get; set; }  
        public 5000 5000 { get; set; }  
        public 50000 50000 { get; set; }  
    }  
  
    public class RetMsg  
    {  
        public string area { get; set; }  
        public string effective { get; set; }  
        public string isp { get; set; }  
        public Prix prix { get; set; }  
        public string scope { get; set; }  
        public string tips { get; set; }  
    }  
  
    public class SufeiNet_Test  
    {  
        public string retCode { get; set; }  
        public string errMsg { get; set; }  
        public RetMsg retMsg { get; set; }  
    }  
  
}  

使用在线工具JSON to C#,生成的类名在项目中无法使用,站长大牛有没有解决方案呢?



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2017-3-15 08:15:51 | 显示全部楼层
第一点上一个帖子我已经说过,先看懂你的Json是集合还是一个对象。这点自己要能清楚

第二点,数字能做为类名吗?显示不能的,我的工具是安逻辑生成的,但不能完全相信工具,工具毕竟是辅助开发的,数字类要手动修改一下。改成自己的类名,解析时参考的是变量名,不是类名。

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-4-27 11:38

© 2014-2021

快速回复 返回顶部 返回列表