What would be the best way to parse this Json?
https://drive.google.com/file/d/1A9-6o99kcIqRM3CEaXxYwh_Dv-vUkvnM/view?usp=sharing
I tried it like this, but I don't get data
var resultJson2 = Json.deserialize<List<ClimaHour>>(result.Result);
public class ClimaHour {
public List<int> couldCover { get; set; }
public List<string> dayOfWeek { get; set; }
public List<string>dayOrNight { get; set; }
public List<int> expirationTimeUtc { get; set; }
public List<int> iconCode { get; set; }
public List<int> iconCodeExtend { get; set; }
public List<int> precipChance { get; set; }
public List<string> precipType { get; set; }
public List<decimal> pressureAltimeter { get; set; }
}
In theory you should just read the content of the json, store it in a ,
string
and pass that variable for deserialization .The only weird thing I noticed in your question, was that you're trying to deserialize a list(
List<ClimaHour>
) fromClimaHour
when it should just be aObjeto
.Another thing is that you use Json.deserialize ... I searched for that library and couldn't find it =/ , that's why the answer I gave is using Newtonsoft .
Now, since you indicate one
url
for said JSON and it is found in Google Drive , we must build a function that returns a valid url for the json deserialization.And the implementation of the method
GetGoogleDriveDownloadLinkFromUrl
, which is inside the classHelpers
I can't take all the credit and I mention that the function that creates the url was taken from this link ; The way to call said function can be by creating a class (as I did) or within the same class that reads the
JSON
, I leave that to your discretion, colleague.