locked
Decode JSON RRS feed

Answers

  • User753101303 posted

    Hi,

    The array is deeper than that (query.result.rows). I would suggest to use copy/paste a json sample to http://json2csharp.com/ which will generate a C# class for this json. You can then use strogly typed code to get to whatever information you want...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 6, 2017 4:50 PM

All replies

  • User753101303 posted

    Hi,

    The array is deeper than that (query.result.rows). I would suggest to use copy/paste a json sample to http://json2csharp.com/ which will generate a C# class for this json. You can then use strogly typed code to get to whatever information you want...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 6, 2017 4:50 PM
  • User347430248 posted

    Hi dow7,

    did you try to use Json.parse?

    if not you can have a try.

     function LaunchApp() {
    
         
            var data = '{"row":[{"symbol":"EURUSD=X","price":"1.1925","change":"+0.0004","percentchange":"+0.0344%"},{"symbol":"EURCHF=X","price":"1.1402","change":"+0.0002","percentchange":"+0.0219%"},{"symbol":"USDCHF=X","price":"0.9561","change":"+0.0002","percentchange":"+0.0230%"},{"symbol":"USDJPY=X","price":"109.0700","change":"-0.1860","percentchange":"-0.1702%"}]}';
    
    	var json = JSON.parse(data);
    
    	alert(json["symbol"]); 
    
    	alert(json.price); 
    
    
    	alert(json.change);
    	
    
    	alert(json.percentchange);
        }

    Reference:

    JSON.parse()

    Regards

    Deepak

    Thursday, September 7, 2017 7:37 AM
  • User-352524747 posted

    Now i have this c# class, can you please show me how to use it?

    public class Row
    {
        public string symbol { get; set; }
        public string price { get; set; }
        public string change { get; set; }
        public string percentchange { get; set; }
    }
    
    public class Results
    {
        public List<Row> row { get; set; }
    }
    
    public class Query
    {
        public int count { get; set; }
        public string created { get; set; }
        public string lang { get; set; }
        public Results results { get; set; }
    }
    
    public class RootObject
    {
        public Query query { get; set; }
    }

    Friday, September 8, 2017 9:33 PM