json

Binding a Generic Java Class to a JSON using JAXB

I have the following java class @XmlRootElement @XmlSeeAlso(DataClass.class) public static class EnvelopeClass<T> { @XmlElement public String version; @XmlElement public T data; EnvelopeClass() { } EnvelopeClass(String version, T data) { this.version = version; this.data = data; } } ...

JSON Array in Flex

Hello! I have code: api_result = '{"response":[{"uid":1969258,"first_name":"Walle","last_name":"Woo"}]}'; var myobj:Object = JSON.decode(api_result); So, how I can get uid, first_name and last_name from "response" array? ...

Error while parsing a Json object

From my jQuery file, I call a function from my controller which returns a Json object, as below: [AcceptVerbs(HttpVerbs.Get)] public ActionResult MatrixTypes() { var matrix = Enum.PricingMatrixType(); return Json(matrix); } The call is made by the following function, I'm posting only ...

Reading JSON arrays from R

Then I read JSON files from R using rjson it seems that JSON arrays (enclosed with []) are converted to (unnamed) R lists, not vectors. Therefore I have to first unlist(recuresice=F) each of those lists before I can work with them. Is there any logic behind this conversion I am missing? I mean, why use a list (and not a vector) to st...

Automatically encode Rack output with JSON when Content-Type is application/json

I've got a modular Sinatra app and I'd like to encode the output as JSON when the content-type dictates. At the moment I'm doing so manually in my routes: get 'someroute' do # content-type is actually set with a before filter # included only for clarity content_type 'application/json', :charset => 'utf-8' # .. # {:su...

How to collect jquery.ajax() data in PHP ?

I send data from javascript to PHP like this: $.ajax({'url': 'my.php', 'type': 'POST', 'data': JSON.stringify(update_data), 'success': function(response) { alert(response); } }); Using HTTPFOX Firefox plug-in I see the following data in the POST DATA tab: {"file...

json call and forms authentication time out

I am making a ASHX handler call to get JSON object. How do I handle or redirect user to login page if forms authentication times out when calling ashx handler page? ...

AJAX: How to replace content of a DIV with a link in same DIV ?

I have index.php like this: <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <div id="workspace">workspace</div> one.php <?php $arr = array ( "workspace" => "<a href='two.php' class='ajax'>two</a>" ); echo json_encode($arr); ...

Reading json data return to jQuery

I'm using the following code to get some json formatted data: $.ajax({ type: "GET", url: "MyService.svc/GetSomeData", dataType: "text", success: function (data, textStatus) { alert("Test: " + data.toString()); }, error: function (xhr, textStatus, er...

Boolean value not being passed with jQuery/ $.get - Why?

I have my front end script which has the following jQuery code: $.get("/backend/post.php", { title: title, message: post, stick: sticky }, function (output) { alert("Call Back"); } }, "json"); stick is a boolean value, the other two are strings. I've confirm...

Ajax JSON Parse Error

I find this kinda strange. it works on older versions of iQuery (ie 1.2.x to 1.3). However, i am getting a parserror when using jQuery 1.4.x Any help will be appreciated. Thank you. This is what i get from XMLHttpRequest.responseText ({count: 5, success: true, error: '', cache: false, data: [{column: ['Mike','Mike','Steve','Steve','St...

Preparing data in json on backend and populating data via ajax on frontend, what're the problems?

Preparing data in json format on backend and populating data to templates via ajax on frontend, what're the problems with this architect design? Assume all visitors use javascript-capable browsers, and we don't care about the number of HTTP connections that a webpage has to make. ...

Haskell Text.Json package can read but not write Rationals?

When I try to decode a JSON file with a floating point number, the Text.JSON package gives me the number as a JSRational. So, I can do a readJSON on a JSRational. However, I can't write rational numbers! Is this on purpose? ...

How to call AJAX request on dropdown change event ?

index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <a href='two.php' class='ajax'>Two</a> <div id="workspace">workspace</div> one.php $arr = array ( "workspace" => "One" ); echo json_encode( $arr ); two.php $arr = ...

How to pass values of form input fields to a script using AJAX/jQuery ?

My current code is like this. index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <select id="dropdown_id"> <option value="one.php">One</option> <option value="two.php">Two</option> </select> <div id="workspace">workspace</div> one.php $arr = array ( "wor...

Convert MySQL record set to JSON string in PHP

Is there a function or class in PHP that I can pass a MySQL recordset and I get a JSON string returned that can be passed back to a JavaScript function in an Ajax request? something like this: function recordSetToJson($recordset) { while($rs1 = mysql_fetch_row($recordset)) { for($count = 0; $count < count($rs1); $count++) { // r...

is json package included in Python for Windows?

is json package included in Python for Windows? ...

YAJL installation and build with xcode 3.2.2

Hi, i've tried following the guide at http://github.com/gabriel/yajl-objc in order to install YAJL into my project but when I try to add a line for the examples i'm getting build errors. "_OBJC_CLASS_$_NSString", referenced from: objc-class-ref-to-NSString in libYAJLIPhone.a(YAJLDocument.o) objc-class-ref-to-NSString in libYAJLIP...

Where can I find a JSON weather api for an iphone app?

most of the ones i've found use xml, and id rather just use the JSON objective c source code. Any suggestions? i have seen this: http://stackoverflow.com/questions/507441/best-weather-apis ...

GWT JSON cross-site request fails

imo i did everything according to the tutorial here Googles x-site /** * Make call to remote server. */ public native static void getJson(int requestId, String url, StockWatcher handler) /*-{ var callback = "callback" + requestId; // [1] Create a script element. var script = document.createElement("script"); ...