json

Adding custom content-types to Firefox application handler?

In Firefox, whenever I request a page that returns a Content-type of "application/json", Firefox saves the file into /tmp but then says "/tmp/json.php could not be opened, because the associated helper application does not exist. Change the association in your preferences." Well, I go into Edit > Preferences > Applications, and there's ...

JSON, JS to Java and Vice Versa, and other languages.

I want to use JSON to represent JS objects send them to a Java program, and vice versa. I would also like to do this for other languages. C# to Java maybe? What do I use to do this? (Not sure if it is refered to as serialization or data binding) Edit: Once a Java object is represented in JSON, does this mean that JavaScript can parse...

How do I add a temporary field to a model in Django?

I'm developing a web-app where the user can create multiple related elements and then save those elements to a database. The webapp has no idea of what the primary keys will be in the database so it assigns each element a UUID. These UUIDs are saved with each element in the database. When the webapp sends the data to the webserver to ...

clean up strange encoding in ruby

I'm currently playing a bit with couchdb. I'm trying to migrate some blog data from redis (key value store) to couchdb (key value store). Seeing as I probably migrated this data a gazillion times from and to different blogging engines (everybody has got to have a hobby :) ), there seem to be some encoding snafus. I'm using CouchREST to a...

csv2json.py error

I am trying to run the script csv2json.py in the Command Prompt, but I get this error: C:\Users\A\Documents\PROJECTS\Django\sw2>csv2json.py csvtest1.csv wkw1.Lawyer Converting C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv from CSV to JSON as C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv.json Traceback (most recent call la...

cant query json

Im using jquery to grab some json data, ive stored it in a var called "ajaxResponse". I cant pull data points out of it, im getting ajaxResponse.blah is not defined. typeof is a string. Thought it should be an object. var getData = function (url) { var ajaxResponse = ""; $.ajax({ url: url, type: "post", ...

Django loaddata ValidationError

This thread got too confusing (for me) so I am asking the question again. I could not make the csv2json.py script mentioned in the original question work. I am just trying to find a way to import data to sqlite3 database. Here's the model I am working with: from django.db import models class School(models.Model): school = mode...

Parsing Twitter feeds in C

I'm trying to figure out how to get the most recent latitude and longitude of a Twitter user (from the new Geo API data, ie the <geo:point> tag, you can see how they look like on my twitter user timeline xml feed). I also need to retrieve how old that data is (in seconds) from the <created_at> tag. I'm trying to write this in C to use w...

Saving and Editing JSON on iPhone/iPod

What's the best method for editing and saving a JSON file on the iPhone/iPod? I know there are libraries that allow you to easily read JSON data, but are there any that allow you to generate it? ...

best practice for loading necessary JSON data: jquery's $(document).ready() hook? in the <HEAD> of page?

Hi everyone, I have been reading Yahoo's Best Practices For Speeding Up Your Website, but still have a question that I could really use your help with: The very first page of my web app needs to display a bunch of data that is dependent on the city the user is in. On the first visit, the user is prompted to pick her city and I store ...

How to Post using JSON and JQuery from a form?

I'm using jQuery and the CloudKit/Tokyo Cabinet backend from an HTML page. All calls are REST/JSON so the server needs JSON data posted. How do I turn the form into JSON and post it? JQuery seems to have a type for JSON return values but not to send JSON. Any ideas? IS it different if it's cross domain? Alex ...

Why does JsonArray.Parse return me primitives with quotes?

I expected the following code JsonArray.Parse("[\"cat\",\"dog\"]")[0].ToString() to give me cat but it actually gives me "cat". Is this a bug or by design. Interestingly there is a private value member which does give cat. (((System.Json.JsonPrimitive)(JsonArray.Parse("[\"cat\",\"dog\"]")[0]))).value will give cat - but its pri...

Serializing resultset returned from mysqldb in python

Can anyone please help me in serializing resultset returned using mysqldb in python? I get typeerror: datetime.date(2007, 11, 15) is not JSON serializable What is the best way to do serialize into Json object in python? I am using json.dumps(resultset) to serialize resultset... ...

JAX-RS, Map<String,String> to JSON without the overhead?

Hi! I'm using JAX-RS to create restful webservices in Java. I am getting to much overhead in the produced JSON. Data class: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Test { private Map<String,String> data; Test() {} public Test(Map<String,String> data) { this.data = data; } publ...

Deserialization with JSON.NET library

Hi there, I've just found out little oddity in behaviour of James Newton-King's library JSON.NET. I'm using it for deserialization of client side JSON custom "features", and everything works - even validity test. Until client sends another type of "feature": CustomJSONConverter converter=new CustomJSONConverter(); MyJSONFeature jsonFea...

How do I parse the inner array out of the json string?

{"genres":[{"total_genres":"2"},{"genre":[{"code":"CTY","name":"Country"}]},{"genre":[{"code":"HOP","name":"Hip Hop / R&B"}]}]} I am tryin to parse the inner array "genre" out of this string. I can get an outer array "genres" if I do: JSONObject outer=new JSONObject(returnContent); JSONArray ja = outer.getJSONArray("genres"); How d...

In PHP, why is json_encode way slower than serialize?

I don't get it, the data produced by json_encode is much more straightforward than serialize and yet both the JSON encode and decode functions are much more slower than the serialize and unserialize counterparts. Why? ...

.NET ASMX - Returning Pure JSON?

I am going nuts here. I've looked at the following entries and none of them are correcting the aberrant behavior I am seeing: http://stackoverflow.com/questions/288850/how-to-return-json-from-a-2-0-asmx-web-service http://stackoverflow.com/questions/1678101/how-to-return-json-from-asp-net-asmx http://stackoverflow.com/questions/211348...

Calling WebService for widgets or composite controls

I have a widget that contains about 40 controls in it. Essentially when a user makes a selection from a Dropdownlist on my main user control, what I want to do is call a webservice to get the new values for the controls in my widget. Is it efficient to have each control essentially call the webservice to get values that pertain to it’s n...

Zend Framework app as a web service

I'm developing a zend framework app that's just going to act as a web service. I have no need to ever output HTML at any point in the application and don't even want the overhead of creating empty view files. I want my app to output XML by default, JSON if requested (via the format parameter would be fine). Is there any way to do this ...