json

Django serializer for one object

I'm trying to figure out a way to serialize some Django model object to JSON format, something like: j = Job.objects.get(pk=1) ############################################## #a way to get the JSON for that j variable??? ############################################## I don't want want: from django.core import serializers serializers.s...

python json loads and unicode

I have the following case where I get the result of UTF-8 encoded HTTP response. I want to load the response content(JSON). However I don't know why I have to do 2 json.loads so that I get the final list: result = urllib2.urlopen(req).read() print result, type(result) #=> "[{\"pk\": 66, \"model\": \"core.job\", \"fields\": {\"customer\"...

JSON JQuery Flickr

I have this JQuery expression $.getJSON("http://api.flickr.com/services/feeds/photoset.gne?set=72157607523855079&amp;nsid=9298216@N08&amp;lang=en-us&amp;format=json&amp;jsoncallback=?", function(data){ $.each(data.items, function(i,item) { $("<img/>").attr("src", item.media.m).appendTo("#images").wrap("<a href='" + item.link + "'...

Which has the most mature stable libraries for multiple languages available for it, YAML or JSON?

I'm not looking for a comparison of the relative merits of YAML or JSON over each other, I'm purely looking for something that is supported by many languages and has stable implementations. Also another plus would be to know which has the libraries that do not have huge dependency trees requiring other libraries. ...

Multiline strings in JSON

Hi, I'm writing some data files in JSON format and would like to have some really long string values split over multiple lines. Using python's JSON module I get a whole lot of errors, whether I use '\' or '\n' as an escape. Is it possible to have multi-line strings in JSON? It's mostly for visual comfort so I suppose I can just turn wor...

Trouble with jQuery's JSON Method

$(function(){ $.getJSON('http://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&amp;user=ElicitBelief&amp;api_key=25135a535781328243f9e31968abc14&amp;format=json', function(data) { alert(data) }); }); Firebug says: GET http://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&amp;user=ElicitBelief&amp...

using JSON in cocoa

I'm using cocoa JSON framework http://code.google.com/p/json-framework/ Here is the result of an JSON output that I get. I can see that results in dictionary Response { "completed_in" = 0.02461; "max_id" = 10088639298; "next_page" = "?page=2&max_id=10088639298&q=apple"; page = 1; query = apple; "refresh_url" = "?since_id=10088639298&q=...

Why is msg.d not supported in Mono 2.6.1?

Currently I have webservice running on the Mono platform. When I call the service I get the data in the form of msg, and not msg.d. Any thoughts? Update: Wow, this turns out to be a big deal. As Phil Haack explains, this opens up the possibility of an XSS attack when you use a GET to fetch the data. Question still stands: should t...

WCF: how can we have services in which their output would be serialized by JSON method?

wcf: how can we have benefits on using JSON serialization in our services? ...

What is the most mature JSON library for Erlang

I wanted to use YAML but there is not a single mature YAML library for Erlang. I know there are a few JSON libraries, but was wondering which is the most mature? ...

jQuery, JSON and Apache problem

Hi! I have an jQuery JSON request, that loads some JSON from another server (ex. foo.com): $.getJSON("http://foo.com/json.php",function(data) { alert(data); }); But I receive data as null. This is not cross-domain issue, I tried following: $.getJSON("http://twitter.com/users/usejquery.json?callback=?", function(data) { alert(dat...

Newtonsoft, Json.Net --> deserializing $ref and $id

Hi! So I'm trying to deserialize an object that has properties: $ref and $id. I have tried going between Dictionary as well as an object where I have specified namingconventions via JsonPropertyAttribute. Serialization works, but deserialization doesn't. The error I keep getting is: Additional text found in JSON string after fini...

excluding fields from json serialization in python using jsonpickle

I am using jsonpickle to serialize an object to json. The object has certain fields that point to other objects. I'd like to selectively not include those in the serialization, so that the resulting json file is essentially pure human-readable text without any funny representations of objects. Is there a way to make jsonpickle ignore cer...

asp.net mvc ajax EnableClientValidation and parse returned data

i use ajax.beginform with EnableClientValidation. problem -the form sends data to controller in any case even the form is not correct -what the proiblem? the second qusion- i return ajax data like this return Json(new { value = "msg" }); how can i parse this data from javascript on view? ...

saving and loading objects from file using jsonpickle

I have the following simple methods for writing a python object to a file using jsonpickle: def json_serialize(obj, filename, use_jsonpickle=True): f = open(filename, 'w') if use_jsonpickle: import jsonpickle json_obj = jsonpickle.encode(obj) f.write(json_obj) else: simplejson.dump(obj, f) ...

Cross-site json rpc : Python server side and Mozilla extension using Javascript client side

hello, I am building a mozilla extension that contacts a python application on a remote server to send and receive data. The python application can be used using xml-rpc from a python console.I am given the task to design a json-rpc that would contact the same application.Making the python server side has been easy which can be accesed u...

Is there a memory efficient and fast way to load big json files in python?

I have some json files with 500MB. If I use the "trivial" json.load to load its content all at once, it will consume a lot of memory. Is there a way to read partially the file? If it was a text, line delimited file, I would be able to iterate over the lines. I am looking for analogy to it. Any suggestions? Thanks ...

Can someone explain how JSON parsers work without using eval at all?

I can't comprehend how it works without using eval - what's the secret behind this? Edit: Could someone present a trivial example of how the tree structure is converted to an object? ...

concat multiple JSONObjects

I am consuming some JSON from two different sources, I end up with two JSONObjects and i'd like to combine them in to one. Data: "Object1": { "Stringkey":"StringVal", "ArrayKey": [Data0, Data1] } "Object2": { "Stringkey":"StringVal", "Stringkey":"StringVal", "Stringkey":"StringVal", } Code, using http://json.org...

How do I send an array in an .ajax post using jQuery?

I have looped through a simple gathering data and pushing it into an array. I am then trying to send that array to a page method (.aspx). There is something about the array that it does not like I think. Here is my code: //packaging table data for submit to server $("#saveToDB").click(function() { var dataFo...