小编Kev*_*ian的帖子

将Json String反序列化为多个Object类型

我有一个从Web服务获得的Json字符串; 它有一个集合列表,每个集合代表一个对象,例如:

  [ // Root List
    [ // First Collection : Team Object
      {
        "id": 1,
        "team_name": "Equipe Saidi",
        "is_active": true,
        "last_localisation_date": "2015-05-06T13:33:15+02:00"
      },
      {
        "id": 3,
        "team_name": "Equipe Kamal",
        "is_active": true,
        "last_localisation_date": "2015-05-06T09:22:15+02:00"
      }
     ],
     [// Second Collection : user Object
      {
        "id": 1,
        "login": "khalil",
        "mobile_password": "####",
        "first_name": "Abdelali",
        "last_name": "KHALIL",
        "email": "KHALIL@gmail.com",
        "role": "DR",
        "is_active": true,
        "charge": false
      },
      {
        "id": 2,
        "login": "ilhami",
        "mobile_password": "####",
        "first_name": "Abdellah",
        "last_name": "ILHAMI",
        "email": "ILHAMI@gmail.com",
        "role": "DR",
        "is_active": true,
        "charge": …
Run Code Online (Sandbox Code Playgroud)

c# serialization json json.net

6
推荐指数
1
解决办法
1万
查看次数

每个x字符后的正则表达式模式

我需要一个正则表达式来匹配以下内容:

在每个字符串的6个字符后面有一个 ';'

例子:

  • aaaaaa;z5z5z5;zdzzzt; (有效)

  • aaadzdaaa;z5z5dzdzz5;zdzdzd; (无效)

我试过了:

(([A-Za-z0-9]{6};$))
Run Code Online (Sandbox Code Playgroud)

但它只根据最后的顺序进行验证.

regex

2
推荐指数
1
解决办法
49
查看次数

标签 统计

c# ×1

json ×1

json.net ×1

regex ×1

serialization ×1