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
524votes
10answers
1.2mviews

Add new attribute (element) to JSON object using JavaScript

How do I add new attribute (element) to JSON object using JavaScript?
user avatar
522votes
17answers
629kviews

Creating a JSON response using Django and Python

I'm trying to convert a server side Ajax response script into a Django HttpResponse, but apparently it's not working. This is the server-side script: /* RECEIVE VALUE */ $validateValue=$_POST['...
user avatar
  • 13.6k
520votes
7answers
360kviews

How can I pretty-print JSON using node.js?

This seems like a solved problem but I am unable to find a solution for it. Basically, I read a JSON file, change a key, and write back the new JSON to the same file. All works, but I loose the JSON ...
user avatar
  • 30.8k
517votes
15answers
781kviews

Chrome sendrequest error: TypeError: Converting circular structure to JSON

I've got the following... chrome.extension.sendRequest({ req: "getDocument", docu: pagedoc, name: 'name' }, function(response){ var efjs = response.reply; }); which calls the following.. ...
user avatar
  • 40.3k
503votes
7answers
402kviews

JSON Naming Convention (snake_case, camelCase or PascalCase) [closed]

Is there a standard on JSON naming?I see most examples using all lower case separated by underscore, aka snake_case, but can it be used PascalCase or camelCase as well?
user avatar
  • 6,751
502votes
28answers
376kviews

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) All I found ...
user avatar
  • 9,119
497votes
20answers
1.8mviews

How to convert jsonString to JSONObject in Java

I have String variable called jsonString: {"phonetype":"N95","cat":"WP"} Now I want to convert it into JSON Object. I searched more on Google but didn't get ...
user avatar
494votes
18answers
291kviews

Error while installing json gem 'mkmf.rb can't find header files for ruby'

For context, it on a remote server which has a firewall. I'm setting up my environment through a proxy. I have ruby 1.8.7. When I try to gem install.. sudo gem install --http-proxy <host address&...
user avatar
  • 8,770
492votes
15answers
379kviews

Deserialize a List<T> object with Gson?

I want to transfer a list object via Google Gson, but I don't know how to deserialize generic types. What I tried after looking at this (BalusC's answer): MyClass mc = new Gson().fromJson(result, new ...
user avatar
  • 7,498
490votes
14answers
783kviews

jQuery AJAX cross domain

Here are two pages, test.php and testserver.php. test.php <script src="scripts/jq.js" type="text/javascript"></script> <script> $(function() { $.ajax({url:"testserver....
user avatar
481votes
32answers
462kviews

Fastest way to check if a string is JSON in PHP?

I need a really, really fast method of checking if a string is JSON or not. I feel like this is not the best way: function isJson($string) { return ((is_string($string) && (...
user avatar
  • 25.2k
476votes
17answers
497kviews

Difference between JSON.stringify and JSON.parse

I have been confused over when to use these two parsing methods. After I echo my json_encoded data and retrieve it back via ajax, I often run into confusion about when I should use JSON.stringify and ...
user avatar
475votes
23answers
166kviews

XSLT equivalent for JSON

Is there an XSLT equivalent for JSON? Something to allow me to do transformations on JSON like XSLT does to XML.
user avatar
  • 36.2k
472votes
4answers
844kviews

Convert JSON string to dict using Python

I'm a little bit confused with JSON in Python. To me, it seems like a dictionary, and for that reason I'm trying to do that: { "glossary": { "title": "example glossary", "...
user avatar
  • 10.5k
467votes
1answer
312kviews

Javascript: How to generate formatted easy-to-read JSON straight from an object? [duplicate]

Possible Duplicate: How can I beautify JSON programmatically? I know how to generate JSON from an object using JSON.stringify, or in my case the handy jquery-json from google code (https://github....
user avatar

15 30 50 per page
1
3 4
5
6 7
22487