json

JSON python to javascript

I want to transfer some data from python to javascript. I use Django at python side and jQuery at javascript side. The object I serialize at python side is a dictionary. Besides simple objects like lists and variables, this dictionary contains instances of SomeClass. To serialize those instances I extendeded simplejson.JSONEncode like...

WCF Service not returning any results in the browser

I am creating an WCF service for my iPhone project, but I contiinue to return blank and not any result in the browser I followed couple of guides but continue to experience the issue Here is what i have Service.svc <%@ ServiceHost Language="C#" Debug="true" Service="Service" CodeBehind="~/App_Code/Service.cs" Factory="System.ServiceM...

Best way to transfer an Entity Framework object over the web and back via JSON

I've got some MVC code that serializes an EF 3.5 object into an anonymous type for return as a JSON result to an AJAX call on my page. The hurdle I have is that when I send the object back to the server via JSON, (and let the ModelBinder deserialize it for me into my EF type), I have to update it in my Entity Framework context manually....

Problem with ASP.NET Web Service and JQuery Client

Am I missing something? I am trying to create a web service and consumer in asp.net, using JSON with JQuery, but I'm not having any luck. I can get JQuery to call the service, and get the service to reply, but the response always goes through the "error" callback in JQuery. When I view the response in FireBug, it appears to be XML, not J...

Search JSON array for matching attribute.

I have a JSON array, I need to return a restaurant's name, but I only know the value of its "food" attribute (not it's index number). For example, how could I return "KFC" if I only knew "chicken"? restaurants = [ {"restaurant" : { "name" : "McDonald's", "food" : "burger" }}, {"restaurant" : { "name" : "KFC", "food" :...

Why doesn't filterJSON work with more complex JSON hierarchy?

I would like to use jQuery filterJSON with flickr, and I found that it does render remote JSON files and not only local ones as shown in its author's demo page. When replacing the default path to local JSON file with remote Twitter JSON file, it renders fine. BUT when using other JSON feeds like the flickr JSON in the code below, returns...

PHP encoding "les validations d'entr\u00e9es"

I have text in this format les validations d'entr\u00e9es instead of les validations d'entrées. This is from Twitter .json API and I would like to translate the \u00e9 to the é but can't find a way to do it. I suppose it's unicode so how can I translate those characters in PHP? Sample of code that I already have: $this->jsonArray =...

REST API in PHP output to JSON file extension

So I want to write a REST API in PHP for JSON for consumption on the iPhone, but also a lot of websites and devices. I have the below code, when accessed via a GET statement, returns a file like: 1mdi2o3.part How do I return something like: users.json $db->setQuery( "SELECT * FROM users"); $db->query() or die($queryError); $numRows ...

Populate a DropDown/Select based on the value chosen on another DropDown

Hello folks, I'm a beginner developer but I stumbled across a case I can't solve. I'm using ASP.NET MVC with C# plus some javascript (JQuery, JSON...). What I have to do is to populate a dropdown based on the value chosen in other. It seems simple (and I know it is) but this particular case is eluding me. I've lost many hours and I'm st...

Passed paramater is null in WCF side.

Hi, I am calling a simple method on WCF side using Jquery. $.ajax({ type: "POST", url: "MyService.svc/TestJSON", data:'{"BikeId":"2"}', //data: '{"BikeId":"'+ id + '"}', contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg...

load json into variable

I have to do something very simple, but there doesn't seem to be an easy way to do this, as far as I can tell. I just want to load JSON data from a remote source and store it in a global Javascript variable using jQuery. Here's what I have: var my_json; $.getJSON(my_url, function(json) { var my_json = json; }); The my_json variable ...

Parsing JSON object in JQuery

Hi, I have simple JSON object returned in form {"d":"{\"Name\":\"DMX100\",\"Description\":\"blah blah\",\"ID\":\" 780\",\"Make\":\"2010\"}"} How do I parse it in success. success: function(msg) { $('#something').html(msg.d.Name); } Above code doesnt display Name but when I pass $('#something').html(ms...

Parsing JSON objects to c#

Hi, I am trying to use the example in this link http://sharpdevpt.blogspot.com/2009/10/deserialize-json-on-c.html?showComment=1265045828773#c2497312518008004159 But my project wont compile using JavaScriptConvert.DeserializeObject, the example says this is from a .net library does anyone know which one? I know the example below uses...

String formatting c# decode?

Hi , I have a string which looks like this '%7B%22id%22%3A1%2C%22name%22%3A%22jim%22%7D' When read from a cookie it is in fact a JSON object and should look like {"id":1,"name":"jim"} Do I need to HTML decode the string to make it appear in the correct JSON notation? Thanks, ...

Is it possible to use javascript to download JSON object from another domain/server?

What would that code look like? ...

JSON and Backslash

Can anyone shed any light as to why my JSON is coming out below, with the extra backslashes. I am using ASP.net MVC to serialise a datatable, when I debug in Visual studio it all looks ok but when I look with firebug with adds the extra characters? Any ideas anyone? "[{\"uid\":\"516219026\",\"pic\":\"http://profile.ak.net/\",\"first_na...

upgraded to jquery 1.4.1 & now getting parse error

I have tried upgrading from jQuery 1.2.6 to 1.4.1. A JSON query is now failing with error : "parseerror, invalid label" I have simplified the code to bare minimum. var jsonUrl = "process_01.php"; $.ajax({ type: "POST", url: jsonUrl, data: "var=myVar", dataType: "json", beforeSend: function(msg) { }, success: fun...

ASP.Net MVC: Creating an Area for json requests...

Hey guys Just wondering what people think about creating an area to hold/manage json based requests (note I am thinking mostly get data not post data). I know its not your typical use of an area (i.e. normally you would create a different area for blog vs forum) but I am getting to the point where my project isn't huge but I definitely...

Problem with JSON, Struts 2 and Ajax.

Hello, I have an apllication with Struts 2, Spring and I want to send JSON as a response to an Ajax request, but my server in not sending the JSON in the response. I have this base package: <package name="myApp-default" extends="struts-default"> <result-types> <result-type name="tiles" class="org.apache.struts2.views.tiles...

what is the best way to parse big JSON file and insert into database using php?

I have this huge JSON file. Currently the way I am using it is: Read the entire contents into a string Do json_decode, get the array Loop through the array one record at a time and build my SQL insert statement Problem is, the code is ugly. Also, some of the objects in these arrays are themselves arrays, and not all records contain...