简体   繁体   中英

Parsing a JSON Result with exhaustive list

Good day, i am trying to parse this JSONObject returned from the OpenWeatherMap forecast API. this is the link link here

now it returns an exhaustive list of results and i just want to get the results for each day at rough 12:00 with the key "dt_txt". i was thinking of something like parsing only the dates and comparing with a date method that increments the current day in a loop and if it matches, i then parse the values for that day. But i wanted to know if there is a better, faster and more efficient solution to achieve this. Many thanks.

Have you tested how long a simple new JSONObject(textFromYourLink) takes? Is it even necessary to optimize the speed?

If there is actually, some need for optimization, I'd suggest that you do some pre-processing of the text and, using some regular expressions, get rid of the parts you don't need. After that, you still can convert the remaining string to a JSONObject which should be done faster now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM