How to deserialize JSON string in .NET 3.5?

  • Thread starter Thread starter Richard.Haggard
  • Start date Start date
R

Richard.Haggard

Guest
I have a client who wants to send a JSON string containing arrays with one or more complex items to a .NET application running version 3.5 with a desire to not depend upon third party libraries.

Here's an example of a passed in JSON string:

{
"users": [
{
"mail_cid": "14193de4-c772-4ee2-8aa3-8d1b06cbf6f2",
"display_name": "Richard Milhouse",
"org_info": null,
"luser_info": "{\"info\": {\"psids\": [\"S-1-16-4096\", \"S-1-1-0\", \"S-1-5-114\", \"S-1-5-21-2744474471-2561516044-1743272080-1002\", \"S-1-5-32-544\", \"S-1-5-32-562\", \"S-1-5-32-559\", \"S-1-5-32-545\", \"S-1-5-4\", \"S-1-2-1\", \"S-1-5-11\", \"S-1-5-15\", \"S-1-11-96-3623454863-58364-18864-2661722203-1597581903-1437548037-3970083271-2547338903-499754375-3403269841\", \"S-1-5-113\", \"S-1-5-5-0-637817\", \"S-1-2-0\", \"S-1-5-64-36\"], \"sid\": \"S-1-5-21-2744474471-2561516044-1743272080-1001\"}, \"platform\": \"win32\"}",
"device": null,
"user_id": "milhouse@msn.com",
"password": "O%r{hOwP>n!_3}nTBl9R)]gD{|+=CPponr_",
"mua_info": {
"imap_password": "O%r{hOwP>n!_3}nTBl9R)]gD{|+=CPponr_",
"imap_port": 4000,
"smtp_password": "O%r{hOwP>n!_3}nTBl9R)]gD{|+=CPponr_",
"imap_username": "milhouse@msn.com",
"smtp_port": 4001,
"imap_addr": "127.0.0.1",
"smtp_username": "milhouse@msn.com",
"smtp_addr": "127.0.0.1"
}
},
{
"mail_cid": "249b4a68-c41e-4c4a-8811-3dce4cf19692",
"display_name": "Richard Milhouse",
"org_info": null,
"luser_info": "{\"info\": {\"psids\": [\"S-1-16-4096\", \"S-1-1-0\", \"S-1-5-114\", \"S-1-5-21-2744474471-2561516044-1743272080-1002\", \"S-1-5-32-544\", \"S-1-5-32-562\", \"S-1-5-32-559\", \"S-1-5-32-545\", \"S-1-5-4\", \"S-1-2-1\", \"S-1-5-11\", \"S-1-5-15\", \"S-1-11-96-3623454863-58364-18864-2661722203-1597581903-1437548037-3970083271-2547338903-499754375-3403269841\", \"S-1-5-113\", \"S-1-5-5-0-131886475\", \"S-1-2-0\", \"S-1-5-64-36\"], \"sid\": \"S-1-5-21-2744474471-2561516044-1743272080-1001\"}, \"platform\": \"win32\"}",
"device": null,
"user_id": "RichardMilhouse@gmail.com",
"password": "Opow8(|.aH;&IY|mof$48&FJm8T9Tr,g,6.",
"mua_info": {
"imap_password": "Opow8(|.aH;&IY|mof$48&FJm8T9Tr,g,6.",
"imap_port": 4000,
"smtp_password": "Opow8(|.aH;&IY|mof$48&FJm8T9Tr,g,6.",
"imap_username": "RichardMilhouse@gmail.com",
"smtp_port": 4001,
"imap_addr": "127.0.0.1",
"smtp_username": "RichardMilhouse@gmail.com",
"smtp_addr": "127.0.0.1"
}
}
]
}
So, keeping in mind that the client really wants to avoid third party libraries and the .NET 3.4 limitation, what sort of JSON deserialization technology should I use to keep my client happy?
Richard Lewis Haggard

Continue reading...
 
Back
Top