json

sending json response

I'm sending a request from jquery and expecting json response. Configuration is like this: type: 'POST', cache: false, iframe: true, dataType: "json", Now there's a funny thing. When I return data as text, it works fine: render :text => "{}" But when I use :json option, firefox prompts me to down...

Attempt to parse JSON without crashing Node.js server.

Hey, I'm developing a project using Node.js at the backed, with that I'm also using JSON to pass data to and from clients over web sockets. The problem I have is that if an invalid string was sent to the server (easily done by the user messing with the JavaScript console) then it would crash the server while trying to parse it. The cur...

ASP.NET MVC - Return JavascriptResult and Json parameter

Here is the scenario In MVC, it is easy to return a Javascript to be executed on the client public ActionResult DoSomething() { return JavaScript("alert('Hello world!');"); } On the client, I have a Javascript that takes a JSon object as parameter Something similar to this : function open(options) {...} I ...

Applet works when ran from Eclipse, not so well in the browser

Hello everyone, I have a Java applet related problem and I would appreciate your help. Here's the story: I tried creating an applet, that would try to connect to digg.com and by using it's API, show the 100 most popular stories (also include some options to sort and filter the results). Anyway, the applet opens and shows the GUI just fi...

How to parse JSONP data returned from remote server

I am trying to grab some data via JSONP. Using Firebug, I am able to see the data properly being returned, but I am having a hard time thinking how I have to parse it. The data return is really a nested array correct? someFunction is the name of the callback function. This is how the data looks: someFunction([ { "title":"Sa...

Checking if file exists using $.ajax() problem

I am having a problem checking if a file exists using $.ajax(). I am looping through a json file with $.each and I want to see if the specified staff member has an image, and if not use the no_photo.jpg image. I keep getting the no_photo.jpg image even though there is the staff member's image in the directory. Here is the entire $.getJS...

Javascript Json inside loop

Hello, I am trying to execute a loop with a JSON query inside it. My code looks something like: for (var i = 0; i < numitems; i++) { var currentitem = items[i]; $.getJSON("http://localhost/items.php", {'itemname' : currentitem}, function (json) { alert (json); }); } But it seems like the for loop doesn't wait for th...

EF default generated classes and JSON

Hi, I have List<Car> cars = from c in myContext.Cars .Include("Wheels") .Include("Wheels.Nuts") orderby c.CarID These are all EF default generated objects. I want to turn this into JSON string containting all cars, each with its wheels, and each wheel with with its nuts, just like I would get ...

problem getting a json multi dimensional array to work with jquery getJSON

i'm using jquery.getJson() to retrieve a json object created by my php script. it works if i remove the locations array. however i need the locations array to populate a combobox. my formatted json is below. any suggestions how i can get this to work with one json query instead of 2. { "ContactID" : "1", "CustomerID" : "1", "FirstName...

Keep set feed order Flickr API

I'm currently trying setting up a little site that pulls in sets from flickr using JavaScript and JSON. It is all working fine except that the order of the photos on the site differs from that of the set on Flickr. I've searched this extensively for a solution, but have had no luck. Has anyone had this issue before? and/or know of a solu...

jquery $.post - json - proper way to send/receive input data (on the client side only) - A Two Questions Quest

Hello all, Let's imagine that we have something like: $.post('somescript.php', 'WHAT CAN WE PUT HERE?', function(replyData) { 1) By default, the third argument of $.POST method, will read the XMLResponse response correct? So, why do we need that argument 'replyData' ? What are the reasons that we may have for having that argu...

jquery $.post second argument. - json or query string?

$.post('somescript.php', { data: $('#myInputField').val() },     function(replyData) { 1) Is the second argument of this $.post method - in json? OR 2) Is the second argument of this $.post method a query string? Thanks in advance, MEM Note: If this question doesn't make sense, please, knowing why (it doesn't make sense) may also h...

how to refer to json fields

Let's asume that I have json variable: var json ={"A":"a","B":"b","x":"y","a":"b"} When I want to refer to A i just write json.A How to do it when I have key in a variable, ie: var key = "A"; Is there any function that returns value or null (if key isn't in json)? ...

Need advice for my Server part

Hey, I'm stuck on my server part. I thing it would be fine if I make an REST architecture but I'm not sure. My application is that an identitied user edit his name, age, hobbies...and I want to stock all the informations of all the users on my data server. Then, I could send the information of a user to another in a ListView with an ad...

Python + JSON, what happened to None?

Dumping and loading a dict with None as key, results in a dict with "null" as the key. Values are un-affected, but things get even worse if a string-key "null" actually exists. What am I doing wrong here? Why cant i serialize/deserialize a dict with "None" keys? Example >>> json.loads(json.dumps({'123':None, None:'What happened to No...

jQuery UI Autocomplete JSON bug

When you have a remote datasource and min character limit, typing a few letters, deleting them, then typing the same ones gives no results. You can see this on the example: http://jqueryui.com/demos/autocomplete/#remote - try typing 'pi' (get results), delete it and type it again (no results). Can anyone fix it or work out how to log th...

Should I use from_xml or from_json for importing objects?

Hello all, I currently have a PHP app that I'm going to be rewriting in Rails. My idea is to slowly replace all of the PHP functionality with Rails, so both will need to run side-by-side (I think I've got this part figured out). Now, at the moment, each of our client's has a separate database, and as it turns out, it would be really gr...

Partial JSON Serialization at Run-Time (for RESTful Queries)

I am trying to convert a Java object to JSON in Tomcat (currently using Jackson). Based on the fields in a RESTful request, I want to serialize only those fields. I want to support requests for any subset of the fields, so I'd like to do it at run-time (dynamically). For example, suppose I want to support partial serialization for User ...

Unicode characters from JSON.stringify to real unicode characters

I use JSON.stringify() function to stringify JS objects for AJAX sending to PHP. The problem arises when JSON.stringify function encodes unicode characters to format \uxxxx (eg. \u000a). My question is how to convert those characters to regular unicode characters in PHP? ...

problem getting json data inside my JqGrid..

I am having problem rendering data in my Jqgrid..My JSON data is in this form [ { "orderNumber": "5917500220100811", "chainNumber": "1", "divisionNumber": "1", "customerNumber": "37029", "loadNumber": "59175", "orderType": "1", "stopSeq": 2, "latestTime": "Aug 13, 2010 ...