json

Django: serializing list to json

I am sending information between client and django server and I would like to use json to this. I am sending simple information - list of strings. I tried using django.core.serializers, but when I did, I got AttributeError: 'str' object has no attribute '_meta' It seems, this can be used only for django objects. How can I serialize si...

how to convert a xml string to a dictionary in python

Hello guys, I've a program that reads a xml document from a socket, so I've the xml document stored in a string which I would like to convert directly to a python dictionary, the same way it is done in django's simplejson library. Take as an example: str ="<?xml version="1.0" ?><person><name>john</name><age>20</age></person" dic_xml = ...

Multiple content div loading with ajax/json

I have implemented external content loading using Ajax. And now I would like to add multiple container loading functionality using a Json object code I have. Could you please help me incorporate the json object code into the Ajax code. My knowledge in coding is very limited :) Here is the detailed info: Here is the json object: var ...

libxml converts accented characters into backlash x escapes. Json is not happy

I have the following attribute in an xml node I'm reading with libxml. It prints out normally with the accented character if I print out reader.node. reader = XML::Reader.new(File.open("somefile.xml", "r")) reader.read reader.read ... p reader.node => ... Full_Name="Univisión Network - East Feed" ... If I do this, though, it comes o...

Using a template to generate json to send to web service

I am generating some json to send to a web service. Currently I am creating a hash, loading it with the data and then calling to_json to generate the json string to send. But I figure it would be much cleaner and more rails like if I could use a template in a .erb file to generate the json for me. All the info I can find on erb files ...

Implementing "searching for ___", "no results" and "search for more results" for jQuery & autocomplete plugin

Hi -- I'm trying to add a function that will display when the AJAX is working, as well as when there are no results. In additionn, when there are many results, I'd like for there to be a link at the bottom of the dropdown to click to see the full search results page. My current code looks like this: <script> jQuery(documen...

In Django, I know how to build a template. render_to_response('something.html'). But, how do I include a JSON object in there?

When the page loads, I have a JavaScript function that needs to analyze the JSON. But, this JSON must be present when I load "something.html" I know how to do this, but I don't know how to combine them together. return HttpResponse(thejson, mimetype="application/javascript") ...

Disappointed with BlazeDS... are there ways around these disadvantages?

I used to use soap webservices for transferring chart data to my flex app, but recently switched over to using BlazeDS because of performance, convenient typing, etc. I'm considering switching over to using JSON (as I do in other parts of the app) for these reasons: Proliferation of DTOs for communicating with flex.* (With JSON, I jus...

Can a json string contain HTML tags with it?

Consider this my json string, [{"Mat_id" : "2","Mat_Name" : "Steel", "Measurement" : "mm","Description" : "Steel"}] Can i add HTML Tags inside this json string like this, [{"Mat_id" : "2","Mat_Name" : "Steel", "Measurement" : "<bold>mm</bold>","Description" : "Steel"}] Whether this is a valid json string? When Eval('('+ thiss...

Reading JSON (with jQuery) produced by PHP containing @attributes

What are those "@attributes" thing I have in my JSON file and how can I read that with JQuery? The JSON "text" I use is produced with json_encode in PHP from an array of custom objects. Here's a reduced JSON file: { "movies" : [ { "url":"http:\/\/www.youtube.com\/watch?v=Nsd7ZcXnL6k", title":{"@attributes":{"type":"text"},"0":"**Title...

Json Vs Conventional Technologies.

We are having a site which are having bulk data like approx 50000 to 100000 records. I want to render this data in my site with paging of 10. Which Technology i should use for that. Performance is key thing of us. So should i use JSON to call web service and with help of JavaScript render data on page. and render the data or should i go ...

Drop Down List auto-update with jQuery in asp.net mvc

If you have a form and the only parts in this form that you need ajaxified is two connected Drop Down Lists, how would be the best asp.net-mvc-like way to solve this? Once the first DropDownList changes value the other DropDownList should be populated depending on the item selected in the first list. This is a fairly common task I would...

Any Method to remove comment characters from JSON response in XCode?

I am new to JSON. Are there any methods in JSON parser to remove the comment characters from a response. Eg. //{"response":"success"....... its SBJson for iPhone. from http://code.google.com/p/json-framework ...

JSON array of objects to .NET Object

I have a large object coming back and I only need a fraction of the data. I was looking at the example here. I essentially want to do the same thing except the problem is I would have an array of "error" objects. So, it would look like this { "short": { "original": "http://www.foo.com/", "short": "krehqk", ...

Please help me refactor this jQuery code

I need to make this jquery run much faster, I did not create all of these functions, but need their methods, to do live translations of page content. So I would appreciate any suggestions to refactor for better performance, the code below. /* function 1 read json into array */ /* function 2 loop through array */ /* function 3 replace...

Json.NET, Unable to de-serialize nullable type.

I'm trying to convert JSON to C# object using Json.NET. The object looks like this in C#: public class MyObject { public int? integerValue {get;set;} public DateTime? dateTimeValue {get;set;} } But when I run JsonConvert.DeserializeObject() on the incoming JSON, I get the following Exception: Unable to find a constructor t...

Unexpected token ILLEGAL javascript error in Google Chrome

I am getting a javascript (prototype.js) error: Unexpected token ILLEGAL at this line of code: newFriend = new friend( response[0].@items[0]._id, response[0].@items[0]._nickName, response[0].@items[0]._profilePicture, response[0].@items[0]._tagLine, response[0].@items[0]._isInvite, response[0].@items[0]._con...

How to "stream" json from server to client using javascript

I'm familiar enough with Ajax and JSON that I can send a request and get a parse a JSON request. Ideally I'd like to receive multiple response to periodically update a progress bar. This way clients can have a positive feedback. I've heard of JSON streams but have not found a good resource on how to implement this. Does anyone know of a...

jQuery: Evaluate script in ajax response

XML responses from my webapp have both HTML to add to the page AND some have a script to run. I'm trying to send back XML from my webapp like: <?xml version="1.0"?> <doc> <html-to-insert> <![CDATA[<p>add me to the page</p>]]> </html-to-insert> <script> <![CDATA[ alert('execute me'); ]]> </script> </doc> What I'm doin...

Is php the right language to program for a large json api such as mochi?

So I am currently using django and the site goes down very often... However, because of that i was thinking if a simpler solution of php is introduced in slurping in the games over to my db and s3 using the following api then i would not have to keep up with the django issues: url: http://www.mochimedia.com/feeds/games/xxxxxx/all?format=...