import json jsonData = ['foo', {'bar': ('baz', None, 1.0, 2)}] with open('sample.json', 'w') as outfile: json.dump(jsonData, outfile, sort_keys= True, indent=4)
“If you can't explain it to a six year old, you don't understand it yourself.” ― Albert Einstein
Showing posts with label JSON. Show all posts
Showing posts with label JSON. Show all posts
Thursday, December 26, 2013
Write to a prettified JSON file in Python (with least number of lines of code)
Tuesday, June 18, 2013
Load JSON Files Synchronously with jQuery
In jQuery, the getJSON operator can load any JSON file, however this operation is done asynchronously. Meaning that, in cases where you need to wait until your data file is loaded, using getJSON method is useless. Here is one way you can achieve your goal of loading JSON files synchronously:
function loadJsonFileSynch() { $.ajax({ url: 'path/to/json/file.json', async: false, dataType: 'json', success: function (response) { $.each(response, function(key, val) { // Do processing here }); } }); }
Subscribe to:
Posts (Atom)