json

How Do I De-Serialize JSON From the Facebook Graph API?

So i'm trying to de-serialize the JSON returned from the Graph API OAuth Token call. The JSON looks like this: "[{\"access_token\":\"bunchofjsondatablahblah",\"expires\":9999}]" I'm trying to de-serialize it (using the DataContractJsonSerializer class) into this object: [DataContract] internal class FacebookOAuthToken { [Dat...

Best JSON library for .NET?

I'm looking forward to write a ASP.NET website which is using JSON to interact with a webservice. JSON.org gives me some choices, but I don't know which is the best, and is there some good libraries that not listed? Thanks in advance. ...

Failing to parse JSON... is the encoding messed up?

I am trying to parse the JSON returned here: http://www.waterwayguide.com/map/php/bridge.php?ll=25.514339,-80.076164 However, I can't parse it as I normally would it seems: NSData *jsonData = [[(ASIHTTPRequest*)[data objectForKey:@"request"] responseString] dataUsingEncoding:NSUTF32BigEndianStringEncoding]; NSLog(@"this prints as expe...

How to decode JSON string to string, not unicode

I'm trying to decode a json of a dictionary with strings as keys. The result is a dictionary with unicode keys. What is the best way to decode to a dictionary with string keys? Better: how do I prevent that strings are decoded into unicode strings? Off course I can loop afterwards... What happens: >>> import simplejson >>> simplejson.l...

After HttpPost, returning a View (ActionResult) when Model is not valid, the response has content type of application/json

I'm running into a strange issue in more than one page of my ASP.NET MVC site. When I POST a form and the Model is NOT valid, I try to return the same view so that I can see the errors - however, instead of the page getting reloaded, I get a pop-up download box that says that the file is in "application/json" format. As you can see fro...

Servlet and error conditions

Hello I'm writing my first JAVA servlet and I have a question. May be it's important to say that my servlet will be called from Google Web Toolkit (AJAX) First thing that I do is to create PrintWriter and start to write in it my JSON output PrintWriter out = response.getWriter(); ... out.println("["); out.println(" {"); out.println...

json to javascript - google charts

In the past I have used the following method to parse the json data appropriately so I can populate a select box: var request = null; request = $.ajax({ type: "POST", url: "url goes here", dataType: 'text', success: function(returned){ returned = JSON.parse(returned) $.each(returned, function(selectid,item) { ...

Error in the file returned from a request to the Last.FM API

I'm using the Last.fm API with jquery as follows: $.getJSON('http://ws.audioscrobbler.com/2.0/?JSONCallback=?',{ method: "user.getweeklytrackchart", user: "rj", api_key: "fb04ae401284be24afba0fbc2f4b0efb" }, function(data) { //console.debug (data) } ); I'm getting the following error in Firebug: ...

HTML form data to recursive json dict

I would like to convert flat form data to recursive JSON data in python or javascript. This JSON data can later be interpreted by a template engine (google for tempest, it has django like syntax). There are plenty examples to convert flat data to recursive data, but the problem is it can't be a dict or list only. I tried to do it in man...

Android itemized overlay Array slowing down

Hi hi, I've got a script which gets data from a MySQL database through an http request, puts it into a json array, then puts each item into an itemized overlay array so that each item can be put onto a map. Problem is, it takes > 5 minutes to load all the items into the itemized overlay, and is then dog-slow at actually running. It sta...

jquery each on a JSON api

I'm trying to loop through the NY Times' search API. The resulting JSON looks like this: {"offset" : "0" , "results" : [{"body" : "NEW ORLEANS — The hemorrhaging well that has spilled millions of gallons of oil into the Gulf of Mexico remained capped for a second day Friday, providing some hope of a long-term solution to the envir...

loop through returned json using jquery

I am getting image and hyperlink information returned in the JSON. I'd like to use the cycle plugin if possible. Example: [["1.jpg","http:\/\/www.this.net\/"],["2.jpg","http:\/\/www.that.net\/"],["3.jpg","http:\/\/www.what.com/l"]] When my html page is first loaded it will already have this: <div id="container"><a id="changeLink" ...

Batch Import of json documents to Apache CouchDb

I have approximately 250,000 JSON-formatted files, each with one object in it (formatted just how CouchDB likes it with _id). What's the best way to import these into my remote CouchDB server as records? -I am on a windows xp machine. -I have internet access but I can't set up a couchDB server on my local machine and have it be WWW ac...

Rename the property in json serialization

in Json.net we can rename the property with [JsonPropertyAttribute("")] , public class Foo { // how can I rename the Foo1 property name to F1?! public string Foo1 { set; get; } public string Foo2 { set; get; } } and in the web service code behind : [WebMethod] public List<...

How to serialize Joda DateTime with Jackson JSON processer?

How do I get Jackson to serialize my Joda DateTime object according to a simple pattern (like "dd-MM-yyyy"? I've tried: @JsonSerialize(using=DateTimeSerializer.class) private final DateTime date; I've tried: ObjectMapper mapper = new ObjectMapper() .getSerializationConfig() .setDateFormat(df); Thanks! ...

Is it a bug for method hash#to_json in Rails?

I use rails 2.3.8 def index @posts = Post.all respond_to do |format| format.html # index.html.erb format.json { render :json => ({ :results => @posts.size, :rows => @posts.to_json(:only => [:id, :title, :click_count, :body])}).to_json } end end the generated json data is: {"rows":"[{\"title\":\"ruby\",...

How to code one jquery function for all AJAX links.

I am using zend framework on windows. I want to implement ajax in my project first time. I searched for help and created a very simple ajax functionality. IndexController.php public function indexAction() { } public function oneAction() { } public function twoAction() { } index.phtml <script type="text/javascript" src="js/jquery-1...

How to add NSDate+BSJSONAdditions to the BSJSON project

Hello, I need to know how to get BSJSON to handle the NSDate that is in coredata in the json it returns null for the date, what needs to go into the category to make this work? ...

inline JSON syntax in PHP

PHP would be a lot cooler if you could write things like this: $array = [2, 3, 5]; $object = { "name" : "Harry", "age" : 23, "cats" : ["fluffy", "mittens", "whiskers"]}; but, I just spent a lot of time looking for an extension (even an experimental alpha or anything) adding json syntax to PHP but found nothing. Does anything like th...

How to convert JSON to XML? (preferably with Yahoo Pipes or Ruby).

There is plenty of information on XML to JSON conversion... But I would like to convert a JSON result into XML. For example the iTunes Search API only provides output in the JSON format. http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/wsSearch?term=jack+johnson&amp;country=US&amp;media=music&amp;entity=musicArtist&amp;limit=6...