Questions tagged [json]

JSON (JavaScript Object Notation) is a serializable data interchange format intended to be 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).

Filter by
Sorted by
Tagged with
707votes
30answers
693kviews

Can I set an unlimited length for maxJsonLength in web.config?

I am using the autocomplete feature of jQuery. When I try to retrieve the list of more then 17000 records (each won't have more than 10 char length), it's exceeding the length and throws the error: ...
user avatar
  • 57.5k
700votes
12answers
515kviews

Saving utf-8 texts with json.dumps as UTF8, not as \u escape sequence

Sample code: >>> import json >>> json_string = json.dumps("ברי צקלה") >>> print(json_string) "\u05d1\u05e8\u05d9 \u05e6\u05e7\u05dc\u05d4" The problem: ...
user avatar
697votes
25answers
798kviews

How to check if a string is a valid JSON string?

isJsonString('{ "Id": 1, "Name": "Coke" }') should be true and isJsonString('foo') isJsonString('<div>foo</div>') should be false. I'm looking for a ...
user avatar
  • 10.6k
691votes
12answers
592kviews

Ignoring new fields on JSON objects using Jackson [duplicate]

I'm using Jackson JSON library to convert some JSON objects to POJO classes on an android application. The problem is, the JSON objects might change and have new fields added while the application is ...
user avatar
650votes
16answers
853kviews

Cannot use object of type stdClass as array?

I get a strange error using json_decode(). It decode correctly the data (I saw it using print_r), but when I try to access to info inside the array I get: Fatal error: Cannot use object of type ...
user avatar
  • 6,509
637votes
20answers
215kviews

Preferred method to store PHP arrays (json_encode vs serialize)

I need to store a multi-dimensional associative array of data in a flat file for caching purposes. I might occasionally come across the need to convert it to JSON for use in my web app but the vast ...
user avatar
  • 16.9k
624votes
19answers
518kviews

Finding the max value of an attribute in an array of objects

I'm looking for a really quick, clean and efficient way to get the max "y" value in the following JSON slice: [ { "x": "8/11/2009", "y": 0.026572007 ...
user avatar
  • 12.8k
616votes
15answers
720kviews

Return JSON response from Flask view

I have a function that analyzes a CSV file with Pandas and produces a dict with summary information. I want to return the results as a response from a Flask view. How do I return a JSON response? @...
user avatar
  • 6,415
581votes
13answers
1.1mviews

How do I iterate over a JSON structure? [duplicate]

I have the following JSON structure: [{ "id":"10", "class": "child-of-9" }, { "id": "11", "classd": "child-of-10" }] How do I iterate over it using JavaScript?
user avatar
573votes
26answers
413kviews

JSON.NET Error Self referencing loop detected for type

I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used JsonConvert.SerializeObject I got the following error: Error Self referencing loop ...
user avatar
  • 6,209
558votes
17answers
572kviews

What is JSON and what is it used for?

I've looked on Wikipedia and Googled it and read the official documentation, but I still haven't got to the point where I really understand what JSON is, and why I'd use it. I have been building ...
user avatar
  • 62.9k
551votes
7answers
778kviews

Representing null in JSON

What is the preferred method for returning null values in JSON? Is there a different preference for primitives? For example, if my object on the server has an Integer called "myCount" with ...
user avatar
  • 16.2k
543votes
10answers
885kviews

Proper way to return JSON using node or Express

So, one can attempt to fetch the following JSON object: $ curl -i -X GET http://echo.jsontest.com/key/value/anotherKey/anotherValue HTTP/1.1 200 OK Access-Control-Allow-Origin: * Content-Type: ...
user avatar
  • 11.9k
535votes
27answers
662kviews

How do I cast a JSON Object to a TypeScript class?

I read a JSON object from a remote REST server. This JSON object has all the properties of a typescript class (by design). How do I cast that received JSON object to a type var? I don't want to ...
user avatar
527votes
17answers
1.3mviews

How can I parse JSON with C#?

I have the following code: var user = (Dictionary<string, object>)serializer.DeserializeObject(responsecontent); The input in responsecontent is JSON, but it is not properly parsed into an ...
user avatar

15 30 50 per page