Skip to main content

Questions tagged [json]

JSON (JavaScript Object Notation) is a serializable data interchange format that is a machine and human readable. Do not use this tag for native JavaScript objects or JavaScript object literals. Before you ask a question, validate your JSON using a JSON validator such as JSONLint (https://jsonlint.com).

11583 votes
39 answers
3.9m views

Which JSON content type do I use?

There are many "standards" for the JSON content type: application/json application/x-javascript text/javascript text/x-javascript text/x-json Which one do I use, and where? I assume ...
Oli's user avatar
  • 239k
9587 votes
62 answers
3.6m views

Can comments be used in JSON?

Can I use comments inside a JSON file? If so, how?
Michael Gundlach's user avatar
4490 votes
8 answers
601k views

Why does Google prepend while(1); to their JSON responses?

Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response while turning a calendar on and off in Google Calendar: while (1); [ ['u', [ ['smsSentFlag', ...
Jess's user avatar
  • 42.7k
3837 votes
31 answers
4.4m views

How do I POST JSON data with cURL?

I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am trying to post a JSON data....
kamaci's user avatar
  • 74.4k
3673 votes
63 answers
1.8m views

How can I pretty-print JSON in a shell script?

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... ...
3463 votes
32 answers
1.9m views

pretty-print JSON using JavaScript

How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.
Mark's user avatar
  • 69k
2472 votes
10 answers
610k views

What is JSONP, and why was it created?

I understand JSON, but not JSONP. Wikipedia's document on JSON is (was) the top search result for JSONP. It says this: JSONP or "JSON with padding" is a JSON extension wherein a prefix is specified ...
Cheeso's user avatar
  • 192k
2160 votes
42 answers
810k views

How do I format a Microsoft JSON date?

I'm taking my first crack at Ajax with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string ...
1969 votes
15 answers
2.3m views

How to prettyprint a JSON file?

How do I pretty-print a JSON file in Python?
Colleen's user avatar
  • 25k
1804 votes
17 answers
2.8m views

How do I write JSON data to a file?

How do I write JSON data stored in the dictionary data to a file? f = open('data.json', 'wb') f.write(data) This gives the error: TypeError: must be string or buffer, not dict
user1530318's user avatar
1764 votes
58 answers
1.1m views

Convert form data to JavaScript object with jQuery

How do I convert all elements of my form to a JavaScript object? I'd like to have some way of automatically building a JavaScript object from my form, without having to loop over each element. I do ...
1759 votes
16 answers
2.0m views

Parse JSON in JavaScript? [duplicate]

I want to parse a JSON string in JavaScript. The response is something like var response = '{"result":true,"count":1}'; How can I get the values result and count from this?
user avatar
1550 votes
16 answers
2.0m views

What is the "right" JSON date format?

I've seen so many different standards for the JSON date format: "\"\\/Date(1335205592410)\\/\"" .NET JavaScriptSerializer "\"\\/Date(1335205592410-0500)\\/\"" .NET ...
Kamyar Nazeri's user avatar
1546 votes
56 answers
1.8m views

How to compare arrays in JavaScript?

I'd like to compare two arrays... ideally, efficiently. Nothing fancy, just true if they are identical, and false if not. Not surprisingly, the comparison operator doesn't seem to work. var a1 = [1,2,...
Julian H. Lam's user avatar
1503 votes
3 answers
2.7m views

Why can't Python parse this JSON data? [closed]

I have this JSON in a file: { "maps": [ { "id": "blabla", "iscategorical": "0" }, { &...
michele's user avatar
  • 26.5k

15 30 50 per page
1
2 3 4 5
24064