What maximum size can a JSON file have?

9

I will give an example to explain my doubt:

I need to retrieve image information from an API, this image bank returns JSON's with information of the images I need, in total there are 33 million images and I will request 100 in 100 thousand.

The structure of a JSON if I ordered 2 images would be:

{
  "meta":{
  "limit":2,
  "offset":0,
  "total_count":33640457
},
"objects":[
  {
     "artist":"sunyyasyed",
     "grid_thumb_url":"http://grid.unlistedimages.com/64830460.jpg",
     "id":64830460,
     "image_name":"k13762459",
     "preview_url":"http://comps.unlistedimages.com/ulcomp/CSP/CSP992/k13762459.jpg",
     "ratio":0.8895689,
     "resource_uri":"/api/v1.0/image/64830460/",
     "subscription_allowed":true,
     "thumbnail_url":"http://photos.unlistedimages.com/thumbs/CSP/CSP992/k13762459.jpg",
     "title":"100 Business, Web, and Office Icons",
     "type":"PHOTO"
  },
  {
     "artist":"kevron2001",
     "grid_thumb_url":"http://grid.unlistedimages.com/62322357.jpg",
     "id":62322357,
     "image_name":"k10882629",
     "preview_url":"http://comps.unlistedimages.com/ulcomp/CSP/CSP990/k10882629.jpg",
     "ratio":1.25,
     "resource_uri":"/api/v1.0/image/62322357/",
     "subscription_allowed":true,
     "thumbnail_url":"http://photos.unlistedimages.com/thumbs/CSP/CSP990/k10882629.jpg",
     "title":"Sunset with open Bible",
     "type":"PHOTO"
  }
]
}

Each image block has 13 lines, or at the end JSON will have ~ 1,300,000 lines, is there a limit to generate a JSON file? it may be that this file (with 43MB of text) can cause problems if I need to read it

    
asked by anonymous 30.11.2017 / 17:31

1 answer

10

In general there is no limit beyond the physical.

The problems that can be caused is not knowing how to load it in memory for being great, although 43MB for today is a toy and does not even have to take special care. If you are using a stream then it should control access to best not "gag" * memory.

What you will do with this information may bring about a specific problem. for example, try to read all the images in it and leave it in memory.

Of course, if you use some tool that has some limit, some specific difficulty there the problem is hers and not JSON.

* At the time of electronic injection and many young people here, there are those who will not know what this is, search in the context of motor :) (not engazopar) The term is not quite this, but it gets funnier like this)

    
30.11.2017 / 17:36