2 Replies Latest reply on Sep 1, 2016 11:23 AM by neffnet

    large object missing from parsed JSON

    neffnet Level 1

      I have a server side function returning some JSON to my PhoneGap app. The data looks something like:

      {

           "authValue": 2,

           "clients": [

                "client1":{...},

                "client2":{...},

           ],

           "sessionInfo": { // this is really big, many keys, nested objects},

           "otherEtcYouGetIt": {... // some more things}

      }

      I can see this data in a browser request to my server, and I can inspect on my phone and see the data in the network request. I can validate the JSON string.

      However, inside my PhoneGap app, sessionInfo is just empty while rest of the data is preserved:

      {

           "authValue": 2,

           "clients":[

                "client1":{...},

                "client2":{...},

           ],

           "sessionInfo":{},

           "otherEtcYouGetIt":{... // some other things}

      }

      Perhaps there is a limit to the string size for JSON in PhoneGap? I don't think there is anything wrong with the actual JSON, it's a huge text but it lints/validates OK. Obviously we should be cleaning up what the server is sending, the app only needs a small fraction of the data in sessionInfo. But I would also really like to know why this is happening, if it is not just a stupid mistake in my code I've overlooked a hundred times.

       

      AJAX request to my server. I see the correct response in the network inspector inside PhoneGap app. But the data returned to the ajax success function has its largest piece replaced with empty object.

       

      Thanks for any suggestions

        • 1. Re: large object missing from parsed JSON
          kerrishotts Adobe Community Professional

          To the best of my knowledge, there's no limit, as is being evidenced by the fact that you can see it inside the network inspector. However, it's possible that the library you're using for AJAX does have a limit.

           

          Suggestions:

           

          - Try a smaller payload just to see if that's really the problem.

           

          - Use XHR directly instead of a library and see if the problem persists.

           

          It might also help to see your AJAX code, if you don't mind.

          1 person found this helpful
          • 2. Re: large object missing from parsed JSON
            neffnet Level 1

            Hey Kerri, thanks for your suggestions.

            This doesn't seem to be an issue anymore... strangely. I don't think it was related to PhoneGap, so you guys can probably disregard. I'm dealing with a lot of poorly-written and half-completed code and having trouble isolating the various issues.

             

            If I can get more info I will return with an update, for now I'm leaving it in the x-files directory