zoukankan      html  css  js  c++  java
  • C# xml2json

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Web;
     5 using System.Web.UI;
     6 using System.Web.UI.WebControls;
     7 using System.Xml;
     8 
     9 namespace xml2json
    10 {
    11     public partial class WebForm1 : System.Web.UI.Page
    12     {
    13         protected void Page_Load(object sender, EventArgs e)
    14         {
    15             string xml = @"<dataestimate>
    16   <OwnerName>CRM06手机端赵雅琪</OwnerName>
    17   <StepName>赵雅琪</StepName>
    18   <DEName>测试环境跑流程---1</DEName>
    19   <ID>150F2263-C56A-E611-80C0-00155DB6760B</ID>
    20   <CPName>测试环境跑流程</CPName>
    21   <AccountInfoName>crm06专属客户</AccountInfoName>
    22   <AccountName>艾迪美通</AccountName>
    23   <Saler>CRM06手机端赵雅琪</Saler>
    24   <SalerList>CRM01杨静</SalerList>
    25   <EFTypeValues>1197CF3B-C56A-E611-80C0-00155DB6760B;1297CF3B-C56A-E611-80C0-00155DB6760B</EFTypeValues>
    26   <Monitor>是</Monitor>
    27   <Budget>234.00</Budget>
    28   <Reason>2344</Reason>
    29   <OwnerSType>100000000</OwnerSType>
    30   <OPOwnerSType>100000000</OPOwnerSType>
    31   <effecttype>
    32     <effecttype>
    33       <EFID>662AC533-C56A-E611-80C0-00155DB6760B</EFID>
    34       <EFName>CPC</EFName>
    35     </effecttype>
    36     <effecttype>
    37       <EFID>1197CF3B-C56A-E611-80C0-00155DB6760B</EFID>
    38       <EFName>CPM</EFName>
    39     </effecttype>
    40     <effecttype>
    41       <EFID>1297CF3B-C56A-E611-80C0-00155DB6760B</EFID>
    42       <EFName>PV</EFName>
    43     </effecttype>
    44     <effecttype>
    45       <EFID>D7849F46-C56A-E611-80C0-00155DB6760B</EFID>
    46       <EFName>点击</EFName>
    47     </effecttype>
    48   </effecttype>
    49 </dataestimate>";
    50 
    51             XmlDocument doc = new XmlDocument();
    52             doc.LoadXml(xml);
    53             string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
    54 
    55 
    56 
    57             Response.Write(json);
    58 
    59         }
    60     }
    61 }
    View Code
  • 相关阅读:
    正则只能输入数字小数点后保留4位
    redis基础之安装和配置
    IDEA 2017下载及注册码
    springcloud zuul 使用zuulfilter 修改请求路径和响应头
    JPA 多表分页查询
    springboot整合JPA创建数据库表失败
    springboot整合fastjson 将null转成空字符串
    Go 结构体和map等数据结构转json字符串
    go项目找不到包问题
    设计模式--策略模式
  • 原文地址:https://www.cnblogs.com/servant/p/5811104.html
Copyright © 2011-2022 走看看