Search code examples
androidjsonlarge-data

Getting Out of memory due to large JSON data


I'm making an Android app. In that Web service sends a JSON object and app parses the object and displays on the screen. In one case, JSON object is too big and I get Out of Memory exception. My solution is to get that JSON object and embed it in the app code, so that it wouldn't need to get that JSON object from the server. Can you tell any other things that I can do for this problem? Or can you tell me how to get that JSON object from Web service?

Thanks.


Solution

  • Sending the large size data from server to mobile. JSON is light weight. If you want to pass the data using more efficient way then passes it in pagination. If you want to use more lighter protocol than JSON then implement the below google protocol which are really useful, which are supporting major languages. Below are smaller Serialised data structure. Google's data interchange protocol.

    1.Google Protocol

    2.Flat Buffers

    3.Nano-proto buffers

    Hope this will be useful you.