How to parse JSON?

I want to create a countdown system in my app. I want to fetch time from server so that no one can hack it. I visited worldtimeapi.org and opened the API in JSON. Can anyone tell me how can I parse this JSON in my app?

Here is the API:

{“week_number”:29,“utc_offset”:"+05:30",“utc_datetime”:“2019-07-21T09:43:12.993925+00:00”,“unixtime”:1563702192,“timezone”:“Asia/Kolkata”,“raw_offset”:19800,“dst_until”:null,“dst_offset”:0,“dst_from”:null,“dst”:false,“day_of_year”:202,“day_of_week”:0,“datetime”:“2019-07-21T15:13:12.993925+05:30”,“client_ip”:“103.9.75.70”,“abbreviation”:“IST”}

Change the blue marked string according to the json.

2 Likes

Thanks! I did that. But how can I set the time in the app now after parsing?

Save the current time fetched from the api and then save it to firebase for later use. When the user opens the app again then compare the stored date with current date.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.