• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Parsing Huge JSON File

 
Ranch Hand
Posts: 70
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm looking for some advice on how I do something.  I have a weather app and want to be able to add locations.  I'm using OpenWeather API and they have a JSON file with about 40,000 cities listed as possible options.

In my app, how would I let the user search these cities?  The JSON file is about 12meg, so I don't really want to put the whole file in, do I?

The JSON has lots more info per city than I need, I just need the name and city code which could actually go into a HashMap.

How should I do this?

Thanks!
 
Sheriff
Posts: 67699
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd write a loader to take the JSON information and put it into a database for quick searches.

I'm pretty sure I heard that Android has a lightweight relational DB, but that's hearsay.
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic