json

.NET Libraries to work with JSON

Hi, We are currently writing our ASP.NET pages using c# and .NET 2.0 framework and we are about 4 months out from upgrading to .NET 3.5 framework. Meanwhile we have a very client-side JS heavy page to push out in 2 months. We are currently looking at JayRock to handle our client-to-server service methods invoking with JSON data. One of...

How to return JSONResult without the browser prompting to save the file?

I am new to MVC, and am trying to make a simple site work. I'm starting to wonder if it is really worth it...I could have had this site up and running with "old-school" ASP.Net two or three times already...but that is beside the point ;-) How can I get my controller to return a JSONResult without the browser prompting me to save the res...

Should I use template or return full code in jquery AJAX?

I am currently working on a project that lets users post comments with jquery and ajax. So far it is using Json and retunring several items, username, comment text, user photo url, comment ID number and stuff like that, I then need to use some sort of template to make all this data go into the correct div's before adding it all to the s...

Using Jackson ObjectMapper to serialize the subclass name into JSON, not the superclass

In the following Jackson/Java code that serializes objects into JSON, I am getting this: {"animal":{"x":"x"}} However, what I actually want to get is this: {"dog":{"x":"x"}} Is there something I can do to AnimalContainer so that I get the runtime type ("dog", "cat") of the object, instead of "animal")? (Edit: I am aware that the ...

Using JSON or postback method?

I need to develop a page which has 2 dropdownlist. Options of dropdownlist 2 are based on selection of dropdownlist 1. I have 2 methods to change the dropdownlist 2. What will you choose? 1: Postback when users select dropdownlist 1 and change dropdownlist 2. Pros: Can use the postback feature, can use the asp.net validator Cons: Need...

PHP StdClass Object accessing a$b

Hello, The below is a dump of variable $x (youtube video). But I want to access media$title, but obviously when I try $x->media$title->$t it does not work. Any suggestions on how to access the title of the youtube video? stdClass Object ( [version] => 1.0 [encoding] => UTF-8 [entry] => stdClass Object ( [xmlns] => http://www.w3...

Binding Json Data in Silverlight

I'm trying to bind a JSON array to a datagrid in Silverlight 3. I do not get any exceptions but I do not see the column values in the datagrid. I do see the rows though, but I do not know what the binding property should be. I do not want to create a class, populate the class and the bind. That works. I do not know what columns and datat...

Is there a Java JSON library that uses the same pattern as XMLEncoder

I have looked at a few JSON libraries for Java, but few of them seem to follow the same serialization pattern as core Java serialization patterns. I would like to use a native Java JSON serialization object, but in the absence of that what third party library matches Native serialization and preferably will serialize anything marked ser...

Return Partial View As JsonResult

I have a partial view that returns an HTML chunk of list items that gets appended onto an unordered list via an AJAX call. This all works fine. However, once I receive the HTML back from the AJAX call, I would like to be able to set some properties on each of the list items via JQuery. In order to do that, I'm assuming that I need to ...

What is the best way to handle returning multiple formats in ASP.NET MVC

Rails has a nice idiom that makes it easy for you to have a single action method return properly formated data (json, xml, just the data) based on the format specified by the client (or else deduced from the request. It looks something like this ... respond_to do |format| format.html #edit.html.erb format.json {render :text=> <your...

JSON decoding in c#

Hi, how to decode a json response in c#? ...

jQuery JSON ASP.NET MVC Access Object with Array List Properties?

I have an object with 2 ArrayList properties. public class TestDTO { public ArrayList Test1 { get; set; } public ArrayList Test2 { get; set; } } I am returning the the object as JSON in my JsonResult Action. The SUCCESS from my AJAX call looks like the following but it does not appear to be working. What do I need to do to a...

Question about JQuery with post and JSON URL params

I'm trying to create a tagcloud for an application. When I click a tag from the tagcloud, the backgroud for the tag must be changed. Here a simple html code for a tag: <a about="http://localhost/d456c6" href="http://localhost/d456c6" class="tagweight0 Resource">abda</a> To change the background i'm using the following: $('tagweight0'...

Strategies to secure a WCF service, returning Json data requested by jQuery

I'm having a hard time getting my head around this, and Google just isn't being helpful. I'm looking at converting some legacy code to use the following technologies: ASP.NET, WCF, jQuery. The ASP.NET conversion isn't an issue, nor is accessing the WCF service for data, on the server-side. However, what I'm having an issue with is pot...

json encoded random generated number is always the same on ie8

i have a php function which returns a random json encoded color <?php function randNum() { return rand(0, 255); } $color = array ('r'=>randNum(),'g'=>randNum(),'b'=>randNum()); echo json_encode($color); ?> on the page i have a jquery function that whenever an event occurs, asks for a color and changes the win...

Displaying HTML content in a Field in blackberry

hi.. I am getting JSON response from the server..Inside that JSON string i am having HTML content which i need to display in a field.. Can anyone help.. ...

Displaying HTML content in a field

I'm getting a JSON response from the server. Inside that JSON string I have HTML content which I need to display in a field. How do I do this? ...

How to return the result from JSONP call outside the function?

I have the following function which works great, i used JSONP to overcome cross-domain, wrote an http module to alter the content-type and didn't append a callback name in the url. function AddSecurityCode(securityCode, token) { var res=0; $.ajax({ url: "http://localhost:4000/External.asmx/AddSecurityCode", data: { securityCode: JSO...

Send JSON with AJAX

Is there anything special I have to do to a JSON object before I send it with AJAX? My code looks like this: runAjax(JSON.stringify(data)); } function runAjax(JSONstring) { ajax = getHTTPObject(); var params = "?data=" + JSONstring; ajax.open("POST", "createtrip.php", true); ajax.setRequestHeader("Content-type", "app...

Zend Framework 1.9.2+ Zend_Rest_Route Examples

With the introduction of Zend_Rest_Route in Zend Framework 1.9 (and its update in 1.9.2) we now have a standardized RESTful solution for routing requests. As of August 2009 there are no examples of its usage, only the basic documentation found in the reference guide. While it is perhaps far more simple than I assume, I was hoping those ...