Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
GeneralRe: Why does this not change my string? Pin
stephen.darling16-Aug-11 7:27
stephen.darling16-Aug-11 7:27 
AnswerRe: Why does this not change my string? Pin
PIEBALDconsult15-Aug-11 15:30
mvePIEBALDconsult15-Aug-11 15:30 
AnswerRe: Why does this not change my string? [modified] Pin
Shameel15-Aug-11 21:33
professionalShameel15-Aug-11 21:33 
GeneralRe: Why does this not change my string? Pin
Matt Meyer16-Aug-11 5:50
Matt Meyer16-Aug-11 5:50 
GeneralRe: Why does this not change my string? Pin
Shameel16-Aug-11 8:45
professionalShameel16-Aug-11 8:45 
QuestionFind asp.net listview control in Item Template Pin
akosidandan15-Aug-11 6:05
akosidandan15-Aug-11 6:05 
AnswerRe: Find asp.net listview control in Item Template Pin
akosidandan15-Aug-11 7:29
akosidandan15-Aug-11 7:29 
QuestionDeserialise complicated Jason data Pin
AndieDu14-Aug-11 15:55
AndieDu14-Aug-11 15:55 
Dear all,

I have this jason data that ready to be serialised: (Indention added for readability)

JavaScript
{"Error":"", 
"UserMeasurements": 
        [{        "MeasurementName":"BloodPressure", 
                  "ClinicalDatas": 
                        [{"Name":"Systolic", 
                          "Unit":"mmHg      ", 
                          "ClinicalDataPoints":[[1304197968110,149],[1304290213920,145],[1304369712717,159],[1304459900650,160], 
                                                                        [1304542964530,176],[1304564292340,147],[1304649916767,141],[1304726125653,139],[1304826583873,156], 
                                                                        [1304880946500,167],[1305069333890,152]]}, 
                         {"Name":"Diastolic", 
                          "Unit":"mmHg      ", 
                          "ClinicalDataPoints":[[1304197968220,129],[1304290215047,92],[1304369712763,91],[1304459900900,105], 
                                                                        [1304542965530,83],[1304564292403,103],[1304649916797,81],[1304726125687,133],[1304826584000,85], 
                                                                        [1304880946547,108],[1305069334890,89]]}, 
                         {"Name":"Mean Blood Pressure", 
                          "Unit":"mmHg      ", 
                          "ClinicalDataPoints":[]} 
                        ] 
                } 
        ] 
}";


and I have these c# code to deserialised it:

C#
namespace Json 
{ 
    public partial class _Default : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            JavaScriptSerializer js = new JavaScriptSerializer(); 
            string test = "{\"Error\":\"\",\"UserMeasurements\":[{\"MeasurementName\":\"BloodPressure\",\"ClinicalDatas\":[{\"Name\":\"Systolic\",\"Unit\":\"mmHg      \",\"ClinicalDataPoints\":[[1304197968110,149],[1304290213920,145],[1304369712717,159],[1304459900650,160],[1304542964530,176],[1304564292340,147],[1304649916767,141],[1304726125653,139],[1304826583873,156],[1304880946500,167],[1305069333890,152]]},{\"Name\":\"Diastolic\",\"Unit\":\"mmHg      \",\"ClinicalDataPoints\":[[1304197968220,129],[1304290215047,92],[1304369712763,91],[1304459900900,105],[1304542965530,83],[1304564292403,103],[1304649916797,81],[1304726125687,133],[1304826584000,85],[1304880946547,108],[1305069334890,89]]},{\"Name\":\"Mean Blood Pressure\",\"Unit\":\"mmHg      \",\"ClinicalDataPoints\":[]}]}]}"; 
 
            Measurement result = js.Deserialize<Measurement>(test); 
        } 
    } 
 
 
    public class Measurement 
    { 
        public string Error { get; set; } 
        public List<UserMeasurement> UserMeasurements { get; set; } 
    } 
 
    public class UserMeasurement 
    { 
        public string MeasurementName { get; set; } 
        public List<ClinicalDatas> UserClinicalDatas { get; set; } 
    } 
 
    public class ClinicalDatas : List<Measurement> 
    { 
        public string Name { get; set; } 
        public string Unit { get; set; } 
        public string[][] ClinicalDataPoints { get; set; } 
    } 
}


I am able to get the value for MeasurementName property, but the UserClinicalDatas always returns null, can someone in here point me out why this is the case? Many thanks.
AnswerRe: Deserialise complicated Jason data Pin
BobJanova14-Aug-11 23:18
BobJanova14-Aug-11 23:18 
GeneralRe: Deserialise complicated Jason data Pin
AndieDu15-Aug-11 14:42
AndieDu15-Aug-11 14:42 
AnswerRe: Deserialise complicated Jason data Pin
Bernhard Hiller17-Aug-11 1:00
Bernhard Hiller17-Aug-11 1:00 
QuestionC# MySQL Question Pin
d87c14-Aug-11 13:18
d87c14-Aug-11 13:18 
AnswerRe: C# MySQL Question Pin
Richard Andrew x6414-Aug-11 13:44
professionalRichard Andrew x6414-Aug-11 13:44 
GeneralRe: C# MySQL Question Pin
d87c14-Aug-11 15:33
d87c14-Aug-11 15:33 
GeneralRe: C# MySQL Question Pin
Richard Andrew x6414-Aug-11 15:39
professionalRichard Andrew x6414-Aug-11 15:39 
GeneralRe: C# MySQL Question Pin
d87c14-Aug-11 16:57
d87c14-Aug-11 16:57 
GeneralRe: C# MySQL Question Pin
PIEBALDconsult14-Aug-11 17:59
mvePIEBALDconsult14-Aug-11 17:59 
GeneralMessage Removed Pin
15-Aug-11 2:44
marssilen15-Aug-11 2:44 
GeneralRe: lame-ass hack attempt removed Pin
#realJSOP15-Aug-11 2:50
professional#realJSOP15-Aug-11 2:50 
GeneralRe: lame-ass hack attempt removed Pin
OriginalGriff15-Aug-11 3:05
mveOriginalGriff15-Aug-11 3:05 
GeneralRe: lame-ass hack attempt removed Pin
GenJerDan15-Aug-11 5:14
GenJerDan15-Aug-11 5:14 
GeneralRe: C# MySQL Question Pin
BoxyBrown15-Aug-11 22:27
BoxyBrown15-Aug-11 22:27 
AnswerRe: C# MySQL Question Pin
Dave Kreskowiak14-Aug-11 16:57
mveDave Kreskowiak14-Aug-11 16:57 
GeneralRe: C# MySQL Question Pin
d87c14-Aug-11 17:01
d87c14-Aug-11 17:01 
AnswerRe: C# MySQL Question Pin
Simon Bang Terkildsen15-Aug-11 1:38
Simon Bang Terkildsen15-Aug-11 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.