json

Parsing JSON from PHP

Hi, I'm trying to iterate in a JSON object that is returned from a PHP script. The return part is something like: $json = array("result" => -1, "errors" => array( "error1" => array("name" => "email","value" => "err1"), "error2" => array("name" => "pass","value" => "err2") ) ); $encoded = json_encode($json...

Rails ActiveRecord BigNum to JSON

Hi, I am serializing an ActiveRecord model in rails 2.3.2 to_json and have noticed that BigNum values are serialized to JSON without quotes, however, javascript uses 64 bits to represent large numbers and only ~52(?) of those bits are available for the integer part, the rest are for the exponent. So my 17 digit numbers become rounded o...

Why is this JSON not being parsed correctly?

My problem is that this JSON is not being parsed by JavaScript or the jQuery API. I am including the code below and a URL where the JSON output is. This JSON is being parsed in JavaScript as nothing: //something like this: alert(data); // gives an object alert(data.horas[0].hora; // gives undefined The JSON itself: {"horas": [{"hora...

Consuming JSON with JavaScript and PHP

2 short questions. I would appreciate an answer or a pointer to an answered question on SO (I searched before asking :)). I'd like to consume one of the TRYNT's web services that returns a JSON object (like this one for example). Am I right in deducing that if they don't specify JSONP, there is no way I can consume those services from ...

Merge two JSON objects programmatically

I have two JSON objects here, generated through the Google Search API. The URL's of these objects can be found below. http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=hello%20world&rsz=large http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=hello%20world&rsz=large&start=8 As you can see the firs...

best way to deal with JSON in django

I am getting a JSON feed from a server and today I convert it to python object and thus to django view. We are now making an update of our site. whereby the browser client should parse json using jQuery also we will have a adobe-air app which will consume JSON directly However I am not so keen on exposing my back-end server directly...

Difference in JSON objects using Javascript/JQuery

I have two JSON objects in Javascript, identical except for the numerical values. It looks like this: var data = { "eth0":{"Tx":"4136675","Rx":"13232319"}, "eth1":{"Tx":"4","Rx":"0"}, "lo":{"Tx":"471290","Rx":"471290"} } var old = { "eth0":{"Tx":"4136575","Rx":"13232219"}, "eth1":{"Tx":"4","Rx":"0"}, "lo":{"Tx":"471290","Rx...

Help with consuming JSON feed with PHP & json_decode

Hello there! I've having an issue with consuming a particular feed for a client. They have given me a remote URL and the response is a JSON string like so: {"affiliate": [ {"ID":"1", "COUNTRY":"EXAMPLE", "NETWORK":"EXAMPLE", "PRIMARY":"EXAMPLE"}, {"ID":"2", "EXAMPLE":"EXAMPLE", "COUNTRY":"EXAMPLE", "NETWORK":"EXAMPLE", "PRIMARY":"EXAMPL...

Options for return ajax requests in a asp.net webforms app

Hi, I have a webforms application, and I need to create a way to respond to ajax requests. I will be either returning HTML or json responses (or maybe even XML). Should I create a .aspx page for this or a handler of some sort? Is setting the content type tricky? ...

Ajax request has to return a list of latest blog posts, json or xml ?

Hi, I need to return a list of blog posts (subject, body, datecreated, commentCount) Should I return a json response or xml? In the calling page, I will have to inject this into the page (its an ajax call). So I need to be able to loop through the blog posts, and create HTML with the blog post info etc. and inject into the page. I'l...

Ajax/JQuery/JSON Forms

Hi all, I've got a form which I need to post the information to an external site, but for some reason I'm getting an error: Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "jquery.core.1-3-2.min.js Line: 19"] Source File: jquery.core.1-3-2.min.js ...

How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?

I have a simple key/value list in JSON being sent back to ASP.NET via POST. Example: { "key1": "value1", "key2": "value2"} I AM NOT TRYING TO DESERIALIZE INTO STRONGLY-TYPED .NET OBJECTS I simply need a plain old Dictionary(Of String, String), or some equivalent (hash table, Dictionary(Of String, Object), old-school StringDictionary-...

can json.net handle a List<object>?

Hi, List<User> list = LoadUsers(); JObject json = new JObject(); json["users"] = new JValue(list); Doesn't seem to be working? Error: oculd not determin JSON object type for type System.Collections.Generic.List ...

Where's my json data in my incoming django request?

It seems like a simple question, but I've been looking for a couple of hours. I'm trying to process incoming JSON/Ajax requests with Django/Python. request.is_ajax() is True on the request, but I have no idea where the payload is with the JSON data request.POST.dir contains this ['__class__', '__cmp__', '__contains__', '__copy__', '_...

How to loop through my Json response using jQuery?

My Json response looks like: [{"UserID": 1}, {"UserID", 324}] I call the page to get json like: $.get("myurl.aspx", {blah:1}, function(data) { $.each(data.items, function(i, item) { alert(item.UserID); }); }); Firebug is reporting the error: G is undefined. ...

How to add items to a unordered list <ul> using jquery

Hi, In my json response, I want to loop through it using $.each and then append items to a <ul></ul> element. $.each(data, function(i, item) { // item.UserID // item.Username } I want to add a , and create a href tag that links to the users page. ...

Validating JSON data.

I am using json in some AJAX request and am currently manually validating each entry using (if "key" in json.some_location.keys()) over and over again. Is there a simpler way to do this (like XML validation)? Note: I am open to validation libraries, but would like something I can drop into django itself (not python eggs). ...

How to process JSON using jquery?

I have a controller that returns a list of custom linq-to-sql model objects in JSON format to jquery ajax calls: List<MyAppLibrary.Model.Search> listSearches = search.ToList(); return new JsonResult { Data = listSearches }; I have the following javascript which gets the response: $.getJSON("/ajax/getbrands", function(data...

Turning nested JSON into an HTML nested list with Javascript...

Hi Everyone, I'm fairly new to using JSON (as opposed to XML) and am currently working purely with Javascript to digest, parse and display my returned JSON data. I'm using the JSON2.js library and am getting back some valid JSON data representing a fairly simple nested list: { "node":{ "class":"folder", "title":"Test Framewo...

Parse JSON in C#

I'm trying to parse some JSON data from the Google AJAX Search API. I have this URL and I'd like to break it down so that the results are displayed. I've currently written this code, but I'm pretty lost in regards of what to do next, although there are a number of examples out there with simplified JSON strings. Being new to C# and .NET...