Combine multiple JSON files into one; retrieve using jQuery/getJSON()

Posted by frankadelic on Stack Overflow See other posts from Stack Overflow or by frankadelic
Published on 2010-04-26T20:49:35Z Indexed on 2010/04/26 20:53 UTC
Read the original article Hit count: 471

Filed under:
|
|
|

I have some jQuery code which retrieves content using getJSON(). There are n JSON files, which are retrieved from the server as needed:

/json-content/data0.json

/json-content/data1.json

/json-content/data2.json

etc...

Instead, I want to store all the JSON in a single file to reduce the number of HTTP requests needed to retrieve the data.

What is the best way to do this? If I concatenate the JSON files together, it no longer works with getJSON().

I would prefer not to transform the JSON data ahead of time, as it is coming from a third party data source.

Any suggestions?

© Stack Overflow or respective owner

Related posts about JSON

Related posts about jQuery