json

Is there a .net solution for sending/receiving json other than IIS

What I basically need is a small console application that listens on port 80 and is capable of putting json objects around. Receiving value types, objects and List<T> (or array) from a JSON client and converting them to .net classes Sending value types, objects and List<T> to the client Outputting some info to the console Performance...

Strategies for rendering HTML with Javascript

I take a fat JSON array from the server via an AJAX call, then process it and render HTML with Javascript. What I want is to make it as fast as humanly possible. Chrome leads over FF in my tests but it can still take 5-8 seconds for the browser to render ~300 records. I considered lazy-loading such as that implemented in Google Reader ...

Jquery Autocomplete with JSON beginners question

I am using the official Jquery Autocomplete plugin. I have an ODBC database with a list of advertisers. I currently have an input box where the user types in part of the name and I am successfully returning a list of partial matches. The problem I'm having is I do not understand how to return both the name and the ID of the advertiser...

How can I parse this particular JSON data from LastFM using jQuery?

I'm attempting to parse a JSON feed using the LastFM API but there are certain elements returned in the JSON array that are prefixed with a # that I don't know how to reference. The feed URL is here and it can be seen visualised here. My jQuery code so far looks like this: $.getJSON('http://ws.audioscrobbler.com/2.0/?method=geo.geteve...

How do I build this JSON object in ruby?

I need to bring an array of ruby objects in JSON. I will need to find the item in the JSON object by id, so I think it is best that the id is the key of each object. This structure makes the most sense to me: { "1": {"attr1": "val1", "attr2": "val2"}, "2": {"attr1": "val1", "attr2": "val2"}, "3": {"attr1": "val1", "a...

Deserialize JSON into C# dynamic object?

Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer. ...

json object setting to default /null value

Hi i am using json.net for converting a json string, i am just pasting a small string here: "incentive_type":{"cost":0,"id":4} "incentive_type":{"cost":{"points":400,"denom":null,"acc":{"foil":{},"rates":{}}},"id":4} now the incentive_type i have declared as : public class incentive_type { public cost cost { get; set; } publ...

Working on my first json from scratch and I can't seem to figure this simple part out..

HAML: = link_to 'redeem', redeem_admin_organization_path(organization), :class => 'button_short live redeem' Controller: def redeem @organization = Organization.find(params[:id]) @organization.update_attribute('accumulated_credits', '0') end redeem.js.haml: == $("#organization_#{@organization.id} .redeem").html("#{escape_javas...

Browser prompting download of JSON response, ASP.NET MVC2

I've encountered this problem all of a sudden doing a simple ajax submit of a form. The JSON comes back formatted correctly but the browser prompts to download it. Fiddler shows the content-type as correct: application/json; charset: utf-8 Here's my javascript: $("#submitbutton").click(function(e) { $.post('FormTest', function(o) {...

Store JSON in a hidden input element?

I need to be able to generate an effectively unlimited number of datasets, so what I want to do is something like this; <input type="hidden" name="items[]" value="{id:1,name:'some-name'}" /> I tried JSON.stringify to convert my array in javascript and store it in the current hidden input element, but it wraps all the keys and values i...

How to output javascript Date in json

I am trying to the timeline chart: http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format Data is coming in the form of a JSON feed. Google wants the data as something like this: { version:'0.6', reqId:'0', status:'ok', sig:'4641982796834063168', table:{ cols:[ ...

Is it possible to XSS exploit JSON responses with proper JavaScript string escaping

JSON responses can be exploited by overriding Array constructors or if hostile values are not JavaScript string-escaped. Let's assume both of those vectors are addressed in the normal way. Google famously traps JSON response direct sourcing by prefixing all JSON with something like: throw 1; < don't be evil' > And then the rest of th...

Why do people put code like "throw 1; <dont be evil>" and "for(;;);" in front of json responses?

Google returns json like this: throw 1; <dont be evil> { foo: bar} and Facebooks ajax has json like this: for(;;); {"error":0,"errorSummary": ""} Why do they put code that would stop execution and makes invalid json? How do they parse it if it's invalid and would crash if you tried to eval it? Do they just remove it from the strin...

how to append data to json in ruby/rails?

Say i have this short code: item = Item.find(params[:id]) render :json => item.to_json but i needed to insert/push extra information to the returned json object, how do i do that? Lets say i need to insert this extra info: message : "it works" Thanks. ...

Is it an efficient way to serialize JSON data in Java ?

I don't know whether this question makes sense or not. I have huge amount of JSON data with me. I am getting that data from Server to the Client side. Is it good idea to serialize the JSON object in server side ? ...

What is the recommended method to read JSON data posted with JQuery AJAX in ASP.NET?

I currently have a JQuery Ajax method as below; $.ajax({ type:"POST", url: "default.aspx/UpdateData", data: jsonString, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg){ alert('saved'); } }); In the ASP.NET UpdateData method I'm using; System.IO.StreamReader sr = new System.IO.StreamR...

WCF service VS JSon in Silverlight view

I have developed one view in Silverlight and currently using WCF services to take data (around 10 MB) from Server to Silverlight view. Even though there is no processing at server side and server is taking less than 1 sec from request recieve to response return but I am getting response in Silverlight after 50 sec. I have deployed WCF se...

Object serializable for AJAX, WCF and ViewState

Hi, consider the following class and struct public class Entity { public IdType Id {get;set;} public string Data {get;set;} } [TypeConverter(IdTypeConverter))] public struct IdType { ... any data ... } The IdTypeConverter can convert the IdType struct from and to string. Now, what I want is this class to be serializable...

event className not working

I am using fullcalendar from arshaw.com/fullcalendar for displaying events on a corporate intranet calendar. I had the className attribute working, made a couple changes to some code and now cannot figure out why it's not working. Here is the json that is returned from my service [ { "allDay":true, "className":"corp...

Core Data and JSON question

I know this question has been possed before, but the explanation was a little unclear to me, my question is a little more general. I'm trying to conceptualize how one would periodically update data in an iPhone app, using a remote web service. In theory a portion of the data on the phone would be synced periodically (only when updated). ...