json

Creating lightweight Linq2Sql proxy objects

I'm trying to find the most efficient way to send my Linq2Sql objects to my jQuery plugins via JSON, preferably without additional code for each class. The EntitySets are the main issue as they cause not only recursion, but when recursion is ignored (using JSON.NET's ReferenceLoopHandling feature) a silly amount of data can be retrieved...

jquery ajax request failing in IE

The following ajax call is failing in IE. $.ajax({ url:"{{SITE_URL}}/content/twitter.json", dataType:"json", error:function(xhr, status, errorThrown) { alert(errorThrown+'\n'+status+'\n'+xhr.statusText); }, success:function(json) { ...Snip... } }); The error function returns Undefined parsererror OK...

Sending binary data to (Rails) RESTful endpoint via JSON/XML?

Hello there, I am currently putting together a rails-based web application which will only serve and receive data via json and xml. However, some requirements contain the ability to upload binary data (images). Now to my understanding JSON is not entirely meant for that... but how do you in general tackle the problem of receiving bina...

How dangerous is it send HTML in AJAX as opposed to sending JSON and building the HTML?

It seems to me that any interception of this could provide instant trouble because anyone could just send any HTML/script back to the client. The only reason I'm interested in doing this is because of the huge pain it is for front-end developers every time there's a DOM structure/CSS change so you now have to go figure out where in the ...

Will providing APIs help deter screen scraping?

I have been thinking quite a bit here lately about screen scraping and what a task it can be. So I pose the following question. Would you as a site developer expose simple APIs to prevent users from screen scraping, such as JSON results? These results could then implement caching, and they are much smaller for traffic than the huge amo...

JSON Syntax: Transmitting an array

A valid JSON Syntax is something of the kind: { "username" : "admin", "password" : "123" } But what if I want to transmit an array of 'users' (given the example), instead of a single 'user' ? Is the code below Valid JSON, according to the specifications? [{ "username" : "admin", "password" : "123" }, { "username" : "bbvb", "password...

JSON Security

Hi, Do Pagemethods and Json have security risks?(I dont use cookies).Forexample i have a pagemethod and i am sending user id as a parameter but i dont want to show it to user.Can user get user id from pagemethod? ...

Concat JSON objects

I have two JSON objects with the same structure and I want to concat them together using Javascript. Is there an easy way to do this? ...

Language with similar object use to Javascript/JSON

I've been doing a project at work recently focused on an almost entirely client-driven web site. Obviously Javascript is used heavily, and I've been using jQuery on top of it which has turned out to be an absolute pleasure to work with. One of the things that has surprised me in this is how much I like the JSON object syntax and it's u...

How can I send a JSON response from a Perl CGI program?

Hi, I am writing a JSON response from a perl/cgi program. The header's content type needs to be "application/json". But it doesn't seems to be recognized as response is thrown as a text file. I would be capturing response using JSON library of jQuery. Where am I missing in sending the JSON response. ...

Emacs mode to edit JSON

Does anybody know a good Emacs mode to edit JSON? An app I am working on uses a JSON based communication protocol and having the data nicely indented and syntax-highlighted would help me a lot in the process of figuring it out. ...

What do you think about Microsoft Oslo MGraph?

MGraph is a great textual data format brought by Microsoft "Oslo". Do you think it has a chance to get as broad as XML is today? Example (Google Geocode): { name = "waltrop, lehmstr 1d", Status { code = 200, request: "geocode" }, Placemark [ { id = "p1", address = "Lehmstraße, 45731 Wa...

401 Returned for every 5th call in an ASP.NET MVC application that returns JSON

This is nuts. I have an ASP.NET MVC application using Windows authentication that, amongst other things, interacts with a number of ExtJs Javascript components by returning JSON data to them. The problem is that even after the user is successfully authenticated, every 5th request to grab some JSON data from MVC results in TWO "401 Unau...

Convert from unicode in jsp for JSON's eval function.

Im getting a string (simplified) from the backend that should be : { "menu": "Reallocate:"} However it comes to jsp as: { "menu": "Reallocate:"} and i cannot pass this to the: var data=eval("(" + src + ")"); as it just doesn't like it.. How can i convert this usable format? I know that: src ...

ASP.NET & JSON: Function to convert GridView and Repeater in a JSON string.

Hi Guys, I need a JavaScript function which will take the Asp.net Repeater as input. The function must then parse through the object and return the data in the the rows of the object as JSON. I can them send the JSON back to the server to be interpreted/parsed and saved to the db. ...

Json to Map

Hi, What is the best way to convert a JSON code as this: { "data" : { "field1" : "value1", "field2" : "value2"}} in a Java Map in which one the keys are (field1, field2) and the values for those fields are (value1, value2). Any ideas? Should I use Json-lib for that? Or better if I write my own parser? Thanks in advance. ...

Is there a streaming API for JSON?

Is DOM the only way to parse JSON. ...

Gotchas while bulk loading CouchDB

I've got ~15k rows in MSSQL 2005 that I want to migrate into CouchDB, where 1 row = 1 document. I have a CLR-UDF that writes n rows to an schema-bound XML file. I have an XSL transform that converts the schema-bound XML to JSON. With these existing tools I'm thinking I can go MSSQL to XML to JSON. If I batch n rows per JSON file, I...

jQuery scope or race condition in AJAX/getJSON

I have a piece of jQuery code which invokes several getJSON() calls in quick succession: var table = $("table#output"); for (var i in items) { var thisItem = items[i]; $.getJSON("myService", { "itemID": thisItem }, function(json) { var str = "<tr>"; str += "<td>" + thisItem + "</td>"; str += "<td>" + json...

Trying to return asp.net mvc JSONResult with VB.Net

Hi Everyone, I'm trying to return a record from LINQ2SQL as a JsonResult to update my view page via jquery ajax. I'll post my code below. When I follow it through the debugger my function in the controller is being called and it is returning a record. I think there might be something wrong with my Jquery to retrieve the JSONResult. ...