2012-04-01 11 views
0

こんにちは私は疑似JSON文字列を解析して逆シリアル化する必要があります。JSONを正規表現で解析し、コレクションに逆シリアル化する

入力データ:

{aBubbleData[ 
    'jaja2581' 
]={ 
    "idUser": 4203666, 
    "nick": "JAja2581", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 9, 
    "videoAlbums": 0, 
    "sefNick": "jaja2581", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 20, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_4203666PARAM_ext?v=4", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_4203666PARAM_ext?v=4", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_4203666PARAM_ext?v=4" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2012-01-28" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "88", 
     "cityName": "Partiz\u00e1nske" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "3", 
     "roomName": "Iba RP", 
     "lastLogin": 1333308615 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 9, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "Som narcis a co Aj jedno slovo potop\u00ed sny...Aj jeden de\u0148\r\nzmen\u00ed \u017eivot...Aj jeden poh\u013ead dok\u00e1\u017ee\r\nu\u010darova\u0165...Aj jedno objatie dok\u00e1\u017ee naplni\u0165\r\npr\u00e1zdnu du\u0161u...", 
     "addTime": "1332089086" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'majinka155' 
]={ 
    "idUser": 4433815, 
    "nick": "Majinka155", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 7, 
    "videoAlbums": 0, 
    "sefNick": "majinka155", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 22, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_4433815PARAM_ext?v=1", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_4433815PARAM_ext?v=1", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_4433815PARAM_ext?v=1" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "0000-00-00" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "137", 
     "cityName": "Nem\u0161ov\u00e1" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "9", 
     "roomName": "Do pohody", 
     "lastLogin": 1333306831 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 7, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "\u017eivot ti rany d\u00e1va, ale ty nie si sama, m\u00e1\u0161 skvel\u00fa l\u00e1sku a nie len na obr\u00e1zku, m\u00e1\u0161 milovan\u00fa os\u00f4bku, \u010do pri tebe stoj\u00ed, preto sa v\u0161etko na svete zahoj\u00ed...", 
     "addTime": "2387" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
} 
    "idUser": 4460957, 
    "nick": "jankaxxx6", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 21, 
    "videoAlbums": 0, 
    "sefNick": "jankaxxx6", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 20, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_4460957PARAM_ext?v=1", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_4460957PARAM_ext?v=1", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_4460957PARAM_ext?v=1" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2012-03-20" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "139", 
     "cityName": "Tren\u010d\u00edn" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "3", 
     "roomName": "Iba RP", 
     "lastLogin": 1333308360 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 21, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 1, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": ".....", 
     "addTime": "1329989508" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'doda1309' 
]={ 
    "idUser": 4656395, 
    "nick": "doda1309", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 8, 
    "videoAlbums": 0, 
    "sefNick": "doda1309", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 19, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_4656395PARAM_ext?v=4", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_4656395PARAM_ext?v=4", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_4656395PARAM_ext?v=4" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "0000-00-00" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "97", 
     "cityName": "Pova\u017esk\u00e1 Bystrica" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "18", 
     "roomName": "\u017dilina", 
     "lastLogin": 1333307236 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 8, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "Pr\u00edbeh jedn\u00e9ho \u010dloveka, je aj pr\u00edbehom t\u00fdch, \u010do svoje \u017eivoty spolu sn\u00edm spojili:):-*", 
     "addTime": "1265308486" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'jamelka12' 
]={ 
    "idUser": 4973811, 
    "nick": "jamelka12", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 8, 
    "videoAlbums": 0, 
    "sefNick": "jamelka12", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 23, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_4973811PARAM_ext?v=3", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_4973811PARAM_ext?v=3", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_4973811PARAM_ext?v=3" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2012-02-25" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "35", 
     "cityName": "Dubnica nad V\u00e1hom" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "26", 
     "roomName": "Tren\u010d\u00edn", 
     "lastLogin": 1333301142 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 8, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "Niektor\u00ed \u013eudia nerobia chyby, preto\u017ee sa v\u00f4bec nepok\u00fasili urobi\u0165 nie\u010do \u010do stoj\u00ed za to ....", 
     "addTime": "1333188968" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'mary1102' 
]={ 
    "idUser": 5881639, 
    "nick": "Mary1102", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 4, 
    "videoAlbums": 0, 
    "sefNick": "mary1102", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 18, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_5881639PARAM_ext?v=3", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_5881639PARAM_ext?v=3", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_5881639PARAM_ext?v=3" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2010-02-26" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "97", 
     "cityName": "Pova\u017esk\u00e1 Bystrica" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "37", 
     "roomName": "Zahrani\u010die", 
     "lastLogin": 1333305516 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 4, 
     "photoAlbumsFavs": 0, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "", 
     "addTime": "1332587902" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'rytmusbaba46' 
]={ 
    "idUser": 8066425, 
    "nick": "rytmusbaba46", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 16, 
    "videoAlbums": 0, 
    "sefNick": "rytmusbaba46", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 23, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_8066425PARAM_ext?v=7", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_8066425PARAM_ext?v=7", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_8066425PARAM_ext?v=7" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2011-01-17" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "139", 
     "cityName": "Tren\u010d\u00edn" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "9", 
     "roomName": "Do pohody", 
     "lastLogin": 1333299734 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 16, 
     "photoAlbumsFavs": 3, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 90, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "\u201eNaozajstn\u00e9ho priate\u013ea nezauj\u00edma, \u010di m\u00e1\u0161 peniaze, \u010di m\u00e1\u0161 n\u00e1ladu, ko\u013eko v\u00e1\u017ei\u0161, \u017ee m\u00e1\u0161 rozbit\u00fd dom, ak\u00e9 m\u00e1\u0161 auto, ak\u00fa m\u00e1\u0161 minulos\u0165, alebo \u017ee \u010di tvoja rodina je pl", 
     "addTime": "1331573798" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    '10_lucinka_1' 
]={ 
    "idUser": 11466424, 
    "nick": "10_LUCINKA_1", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 16, 
    "videoAlbums": 0, 
    "sefNick": "10_lucinka_1", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 14, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_11466424PARAM_ext?v=3", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_11466424PARAM_ext?v=3", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_11466424PARAM_ext?v=3" 
    }, 
    "PLUS": { 
     "active": false, 
     "activeTo": "2012-03-23" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "2", 
     "cityName": "B\u00e1novce nad Bebravou" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "3", 
     "roomName": "Iba RP", 
     "lastLogin": 1333304089 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 16, 
     "photoAlbumsFavs": 2, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": ":) :*", 
     "addTime": "1331928446" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "noAddGift": 1 
};aBubbleData[ 
    'digica' 
]={ 
    "idUser": 11970671, 
    "nick": "digica", 
    "photo": 1, 
    "sex": 2, 
    "photoAlbums": 27, 
    "videoAlbums": 0, 
    "sefNick": "digica", 
    "profilPercent": 100, 
    "emphasis": false, 
    "age": 29, 
    "isBlocked": false, 
    "PHOTO": { 
     "normal": "PARAM_pm.aimg.sk\/profil\/n_11970671PARAM_ext?v=2", 
     "medium": "PARAM_pm.aimg.sk\/profil\/m_11970671PARAM_ext?v=2", 
     "24x24": "PARAM_pm.aimg.sk\/profil\/s_11970671PARAM_ext?v=2" 
    }, 
    "LOCATION": { 
     "idRegion": "6", 
     "regionName": "Tren\u010diansky kraj", 
     "idCity": "103", 
     "cityName": "Prievidza" 
    }, 
    "STATUS": { 
     "isLoged": true, 
     "isChating": true, 
     "idChat": "3", 
     "roomName": "Iba RP", 
     "lastLogin": 1333304814 
    }, 
    "PROJECT_STATUS": { 
     "photoAlbums": 27, 
     "photoAlbumsFavs": 1, 
     "videoAlbums": 0, 
     "videoAlbumsFavs": 0, 
     "videoAlbumsExts": 0, 
     "blogPosts": 0 
    }, 
    "STATUS_MESSAGE": { 
     "statusMessage": "ZO VSETKYCH BREMIEN NA SVETE JE NAJTAZSIA BYTOST,KTORU SME PRESTALI MILOVAT.", 
     "addTime": "1333294363" 
    }, 
    "isFriend": false, 
    "isIamFriend": false, 
    "bubbleSkinNumber": 18, 
    "noAddGift": 1 
}; 

問題は、上記のその文字列は有効なJSONされていないです。文字列にはユーザーのニックネームとプロファイルのリストが含まれます。

私の考えでは、このフォーマットに上記transfor文字列です:

{ 
    "userNick": { 
     "idUser": 4203666, 
     "nick": "JAja2581", 
     "photo": 1, 
     "sex": 2, 
     "photoAlbums": 9, 
     "videoAlbums": 0, 
     "sefNick": "jaja2581", 
     "profilPercent": 100, 
     "emphasis": false, 
     "age": 20, 
     "isBlocked": false, 
     "PHOTO": { 
      "normal": "PARAM_pm.aimg.sk/profil/n_4203666PARAM_ext?v=4", 
      "medium": "PARAM_pm.aimg.sk/profil/m_4203666PARAM_ext?v=4", 
      "24x24": "PARAM_pm.aimg.sk/profil/s_4203666PARAM_ext?v=4" 
     }, 
     "PLUS": { 
      "active": false, 
      "activeTo": "2012-01-28" 
     }, 
     "LOCATION": { 
      "idRegion": "6", 
      "regionName": "Trenčianskykraj", 
      "idCity": "88", 
      "cityName": "Partizánske" 
     }, 
     "STATUS": { 
      "isLoged": true, 
      "isChating": true, 
      "idChat": "3", 
      "roomName": "IbaRP", 
      "lastLogin": 1333308615 
     }, 
     "PROJECT_STATUS": { 
      "photoAlbums": 9, 
      "photoAlbumsFavs": 0, 
      "videoAlbums": 0, 
      "videoAlbumsFavs": 0, 
      "videoAlbumsExts": 0, 
      "blogPosts": 0 
     }, 
     "STATUS_MESSAGE": { 
      "statusMessage": "SomnarcisacoAjjednoslovopotopísny...Ajjedendeň\r\nzmeníživot...Ajjedenpohľaddokáže\r\nučarovať...Ajjednoobjatiedokáženaplniť\r\nprázdnudušu...", 
      "addTime": "1332089086" 
     }, 
     "isFriend": false, 
     "isIamFriend": false, 
     "noAddGift": 1 
    } 
} 

私はこの形式でJSON文字列を持っている場合、デシリアライズ辞書を行うことが可能となります。

だから私の問題は、上の文字列の解析とプロファイルの解析方法です。私はこの部分から解析することができ

aBubbleData[ 
     'jaja2581' 
    ]={ 
     "idUser": 4203666, 
     "nick": "JAja2581", 
     "photo": 1, 
     "sex": 2, 
     "photoAlbums": 9, 
     "videoAlbums": 0, 
     "sefNick": "jaja2581", 
     "profilPercent": 100, 
     "emphasis": false, 
     "age": 20, 
     "isBlocked": false, 
     "PHOTO": { 
      "normal": "PARAM_pm.aimg.sk\/profil\/n_4203666PARAM_ext?v=4", 
      "medium": "PARAM_pm.aimg.sk\/profil\/m_4203666PARAM_ext?v=4", 
      "24x24": "PARAM_pm.aimg.sk\/profil\/s_4203666PARAM_ext?v=4" 
     }, 
     "PLUS": { 
      "active": false, 
      "activeTo": "2012-01-28" 
     }, 
     "LOCATION": { 
      "idRegion": "6", 
      "regionName": "Tren\u010diansky kraj", 
      "idCity": "88", 
      "cityName": "Partiz\u00e1nske" 
     }, 
     "STATUS": { 
      "isLoged": true, 
      "isChating": true, 
      "idChat": "3", 
      "roomName": "Iba RP", 
      "lastLogin": 1333308615 
     }, 
     "PROJECT_STATUS": { 
      "photoAlbums": 9, 
      "photoAlbumsFavs": 0, 
      "videoAlbums": 0, 
      "videoAlbumsFavs": 0, 
      "videoAlbumsExts": 0, 
      "blogPosts": 0 
     }, 
     "STATUS_MESSAGE": { 
      "statusMessage": "Som narcis a co Aj jedno slovo potop\u00ed sny...Aj jeden de\u0148\r\nzmen\u00ed \u017eivot...Aj jeden poh\u013ead dok\u00e1\u017ee\r\nu\u010darova\u0165...Aj jedno objatie dok\u00e1\u017ee naplni\u0165\r\npr\u00e1zdnu du\u0161u...", 
      "addTime": "1332089086" 
     }, 
     "isFriend": false, 
     "isIamFriend": false, 
     "noAddGift": 1 
    };aBubbleData[ 
     'majinka155' 
    ]={ 
     "idUser": 4433815, 
     "nick": "Majinka155", 
     "photo": 1, 
     "sex": 2, 
     "photoAlbums": 7, 
     "videoAlbums": 0, 
     "sefNick": "majinka155", 
     "profilPercent": 100, 
     "emphasis": false, 
     "age": 22, 
     "isBlocked": false, 
     "PHOTO": { 
      "normal": "PARAM_pm.aimg.sk\/profil\/n_4433815PARAM_ext?v=1", 
      "medium": "PARAM_pm.aimg.sk\/profil\/m_4433815PARAM_ext?v=1", 
      "24x24": "PARAM_pm.aimg.sk\/profil\/s_4433815PARAM_ext?v=1" 
     }, 
     "PLUS": { 
      "active": false, 
      "activeTo": "0000-00-00" 
     }, 
     "LOCATION": { 
      "idRegion": "6", 
      "regionName": "Tren\u010diansky kraj", 
      "idCity": "137", 
      "cityName": "Nem\u0161ov\u00e1" 
     }, 
     "STATUS": { 
      "isLoged": true, 
      "isChating": true, 
      "idChat": "9", 
      "roomName": "Do pohody", 
      "lastLogin": 1333306831 
     }, 
     "PROJECT_STATUS": { 
      "photoAlbums": 7, 
      "photoAlbumsFavs": 0, 
      "videoAlbums": 0, 
      "videoAlbumsFavs": 0, 
      "videoAlbumsExts": 0, 
      "blogPosts": 0 
     }, 
     "STATUS_MESSAGE": { 
      "statusMessage": "\u017eivot ti rany d\u00e1va, ale ty nie si sama, m\u00e1\u0161 skvel\u00fa l\u00e1sku a nie len na obr\u00e1zku, m\u00e1\u0161 milovan\u00fa os\u00f4bku, \u010do pri tebe stoj\u00ed, preto sa v\u0161etko na svete zahoj\u00ed...", 
      "addTime": "2387" 
     }, 
     "isFriend": false, 
     "isIamFriend": false, 
     "noAddGift": 1 
    } 

NICK

一人のユーザがあるが、この形式の文字列で表し

aBubbleData[ 
     'jaja2581' 
    ] 

この場合ニックjaja2581

ありますユーザープロフィールはこの場合ですthi Sパーツ:

{ 
     "idUser": 4203666, 
     "nick": "JAja2581", 
     "photo": 1, 
     "sex": 2, 
     "photoAlbums": 9, 
     "videoAlbums": 0, 
     "sefNick": "jaja2581", 
     "profilPercent": 100, 
     "emphasis": false, 
     "age": 20, 
     "isBlocked": false, 
     "PHOTO": { 
      "normal": "PARAM_pm.aimg.sk\/profil\/n_4203666PARAM_ext?v=4", 
      "medium": "PARAM_pm.aimg.sk\/profil\/m_4203666PARAM_ext?v=4", 
      "24x24": "PARAM_pm.aimg.sk\/profil\/s_4203666PARAM_ext?v=4" 
     }, 
     "PLUS": { 
      "active": false, 
      "activeTo": "2012-01-28" 
     }, 
     "LOCATION": { 
      "idRegion": "6", 
      "regionName": "Tren\u010diansky kraj", 
      "idCity": "88", 
      "cityName": "Partiz\u00e1nske" 
     }, 
     "STATUS": { 
      "isLoged": true, 
      "isChating": true, 
      "idChat": "3", 
      "roomName": "Iba RP", 
      "lastLogin": 1333308615 
     }, 
     "PROJECT_STATUS": { 
      "photoAlbums": 9, 
      "photoAlbumsFavs": 0, 
      "videoAlbums": 0, 
      "videoAlbumsFavs": 0, 
      "videoAlbumsExts": 0, 
      "blogPosts": 0 
     }, 
     "STATUS_MESSAGE": { 
      "statusMessage": "Som narcis a co Aj jedno slovo potop\u00ed sny...Aj jeden de\u0148\r\nzmen\u00ed \u017eivot...Aj jeden poh\u013ead dok\u00e1\u017ee\r\nu\u010darova\u0165...Aj jedno objatie dok\u00e1\u017ee naplni\u0165\r\npr\u00e1zdnu du\u0161u...", 
      "addTime": "1332089086" 
     }, 
     "isFriend": false, 
     "isIamFriend": false, 
     "noAddGift": 1 
    };aBubbleData[ 
     'majinka155' 
    ]={ 
     "idUser": 4433815, 
     "nick": "Majinka155", 
     "photo": 1, 
     "sex": 2, 
     "photoAlbums": 7, 
     "videoAlbums": 0, 
     "sefNick": "majinka155", 
     "profilPercent": 100, 
     "emphasis": false, 
     "age": 22, 
     "isBlocked": false, 
     "PHOTO": { 
      "normal": "PARAM_pm.aimg.sk\/profil\/n_4433815PARAM_ext?v=1", 
      "medium": "PARAM_pm.aimg.sk\/profil\/m_4433815PARAM_ext?v=1", 
      "24x24": "PARAM_pm.aimg.sk\/profil\/s_4433815PARAM_ext?v=1" 
     }, 
     "PLUS": { 
      "active": false, 
      "activeTo": "0000-00-00" 
     }, 
     "LOCATION": { 
      "idRegion": "6", 
      "regionName": "Tren\u010diansky kraj", 
      "idCity": "137", 
      "cityName": "Nem\u0161ov\u00e1" 
     }, 
     "STATUS": { 
      "isLoged": true, 
      "isChating": true, 
      "idChat": "9", 
      "roomName": "Do pohody", 
      "lastLogin": 1333306831 
     }, 
     "PROJECT_STATUS": { 
      "photoAlbums": 7, 
      "photoAlbumsFavs": 0, 
      "videoAlbums": 0, 
      "videoAlbumsFavs": 0, 
      "videoAlbumsExts": 0, 
      "blogPosts": 0 
     }, 
     "STATUS_MESSAGE": { 
      "statusMessage": "\u017eivot ti rany d\u00e1va, ale ty nie si sama, m\u00e1\u0161 skvel\u00fa l\u00e1sku a nie len na obr\u00e1zku, m\u00e1\u0161 milovan\u00fa os\u00f4bku, \u010do pri tebe stoj\u00ed, preto sa v\u0161etko na svete zahoj\u00ed...", 
      "addTime": "2387" 
     }, 
     "isFriend": false, 
     "isIamFriend": false, 
     "noAddGift": 1 
    } 

たぶん私はREGEXを使用し、リストにすべてのニックおよびプロファイルを抽出して、私はデシリアライズすることができますJSON文字列を作成することができます。

それとも良いアイデアはありますか?

答えて

1

あなたのデータ構造はかなりシンプルなので、ここで正規表現を使うことができます。レコードはaBubbleDataのリテラルで始まり、その中にニックネームが引用符で囲まれた、角括弧のセット(等号)で始まります。次に、aBubbleDataリテラルまたはストリングアンカーの末尾のセミコロンで終わるプロファイルデータが表示されます。私はあなたがあなたのデータパーサーを書いて検討すべきだと思うあなたのデータ構造が複雑になる場合

var regex = new Regex(
    @"aBubbleData\[\s*'(?<nick>\w+)'\s*\]=(?<profile>.*?);(?=aBubbleData|$)", 
    RegexOptions.Singleline 
); 
foreach (Match match in regex.Matches(text)) 
{ 
    var nick = match.Groups["nick"].Value; 
    var profile = match.Groups["profile"].Value; 
    // you could deserialize profile here 
} 

しかし:ここ

は、このために、単純な正規表現(私はnickprofileのための名前付きグループを使用)です。