I'm learning to use JSON with AJAX. I have the AJAX part down fine. It's the JSON part I'm unsure about. I've searched for some answers to some really simple questions but it seems that everything I find is jQuery or not what I am looking for.

Question: how do I escape JSON data I plan to submit using AJAX via the POST method? Here is my JSON object:

var json_data = 
		'band': 'The Beatles',
		'country': 'England',
		'year_formed': '1963',
		'style': 'Rock',
		'members': ['Paul', 'John', 'George', 'Ringo']
	data = encodeURIComponent(json_data);
When I do a document.write on the variable data, all it displays is "%5Bobject%20Object%5D".

So, how do I escape this JSON data so I can submit it to the server? I have the feeling I am not doing something right.

I do not want to use any libraries and am not going to download JQuery or anything from json.org. I am trying to learn this right now. I also am not going to use any built-in browser objects because they are not widely supported yet.

Thank you for your help!