Is there any difference between a .json, .txt, .html, .css, and .js file other than the extension?

Viewed 2709

The impetus is: I have some JSON that I've been saving as .txt files for a bit. I'd like to rename them all to .json to be more accurate. I'm pretty sure they are both UTF-8, as are most files that can be sent over Ajax.

Anyways, this question raised a bigger question.

Is there any real difference between all of these text types, other than the extension? .html, .json, .css, .js, .txt, .py, etc... they all appear to be the same thing on the inside: a UTF-8 character array.

If you used these interchangeably, would it do anything worse than being confusing? Do any of these have headers? Do any of them encode differently when being saved? Are most .txt files with a different extension?

1 Answers
Related