json

Error while executing Integration Test with JSON output

Below is my action in the controller. I am to btest this action via an integration test. This would require me to mock the session objects as well. I have started with the integration test , but hve no luck with it. def listData= { def playerId=session["playerId”] tuneInstanceList = tuneService.calculateId(playerId) ...

set content-type to json in symfony

I am using symfony 1.4, to create my project with propel as ORM. i want to get the response in JSON format, when i call a url. I have set the headers to "application/json" but it is not working, i am getting the response back in HTML format..which i am not able to decode. How can we set content-type in symfony?? example code: Action- ...

XSLT help running in java.

Im new to the XSLT world, I am basically trying to run the JSON convertion from HERE However if I use this method: TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource("src\\json\\xml-to-json.xsl")); transformer.transform(new StreamSource("src...

Security Request for JSon Result in Asp.Net MVc

Hello Guys, I developed an application in ASP.NET MVC. This app has an action that returns a JsonResult and I get it with jquery in client side. Everything works fine but I'd like to know, if is there any way to make a security in this action to return only requests that came from my website. Is there any way to avoid others websites t...

Javascript script to change the source of an image

Hi, I am using flexigrid for one of my projects and I need to come up with a way to change the image source depending on the value of one of the cells. For people who are used to flexigrid, I have the following code: $json .= ",'".addslashes("<span><img src='' id='flag' />" . $row['availability']. "</span>")."'"; and my javascript t...

Please Help ==> Ruby on Rails -- JavaScript

I have a button on my Ruby on Rails view file. Firstly when the button is clicked an ajax call is made which in response gives a json string. So far I have accomplished this task. I am stuck here: The button also redirects me to another action of the same controller. Now I want to send the json string received by javascript as a parame...

Is there an 3rd party library for parsing JSON on the iPhone?

Is there an 3rd party library for parsing JSON on the iPhone? ...

Sequential AJAX Requests

I have a situation where I need to make sequential AJAX requests represented by an ordered list (<ol><li>..) on the page. I use jQuery. Requirements: Each request has to wait for the previous one to complete with a successful status. The success or error message needs to be appended to the corresponding list item. The process should h...

Why can DateTime.MinValue not be serialized in timezones ahead of UTC?

I am experiencing issues with a WCF REST service. The wire object that I try to return has certain properties not set, resulting in DateTime.MinValue for properties of type DateTime. The service returns an empty document (with HTTP status 200 ???). When I try to call JSON serialization myself, the exception that is thrown is: Seriali...

Wrong number of arguments for a helper

I'm trying to generate a form from a parsed json (in Hash form) with this helper def hash_to_form(hash, fields, legend) fields.fields_for do |b| concat('<fieldset><legend>', legend, '</legend>') hash.each do |key, attr| if hash[key].is_a? Hash hash_to_form(hash[key], b, key) else conca...

javascript/jQuery: how do you dynamically turn attribute values into object keys?

Here is my problem, I have a whole bunch of elements that look like this... <input type="email" id="email" data-item="email" data-key="contact_details"/> <input type="tel" id="mobileNo" data-item="mobileNo" data-key="contact_details"/> <input type="text" id="sleeve_length" data-item="sleeve_length" data-key="measurements"/> <input type...

[function.file-get-contents]: failed to open stream: HTTP request failed

Here is a snippet of my code: include("JSON.php"); $json = new Services_JSON(); $value=array('jsonrpc'=>'2.0', 'method'=>'methodname', 'params'=>array('param1',"param2"),'id'=>1); $output = $json->encode($value); print($output); $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept: application/json\r\n"."Content-t...

need a Saple JSON parser in objective c

I want to know to parse a json object in objective c... i get the json object by loading a url.... can u please tell me how to do it or any samples or any reference.... the following is the sample json... {"name":"WFNX","now": {"id":"17749528","song":"Back Down South","artist":"Kings Of Leon"}, "desc":"101.7 - True Alternative",...

Why is XMLHttpRequest.status == 0 on all the browsers except IE?

Hi guys! I'm getting insane with this one... I made a RESTful.NET webservice with C# and is running as a standalone service. When I make a XMLHttpRequest to retrieve JSON data, all browsers fail, except IE, because the status flag of the instance of XMLHttpRequest is always 0 -- it should be 200, that it's what's happening with IE. I ...

Deserializing JSON 2 Dimension array of values

Hi all, I've got a 2 dimensional of values in JSON format: [[57, 2], [57, 2], [58, 2], [55, 2], [60, 2], [54, 1], [59, 11]] Each of the pairs actually contains a pair of unrelated readings, and there is one pair for each minute. So in the first min, reading 1 is 57 and reading 2 is 2 and in the second minute, the readings are the same...

Parsing RSS Feed with JSON and Populating a List Android App

Hi , Im brand new to Android Application development and I am working on an application that will get an RSS feed from a specific url that returns JSON data , what I am wondering is what is the best way to translate this from JSON to populate the list , I was thinking of making objects to hold the individual posts and then create a list...

Load data from Webservice (asmx) to jqgrid. Please help me

I create a Sample to test jqgrid. GetDataService.asmx: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Web.Script.Services; using System.Web.Script.Serializatio...

Markup in JSON loop not getting output to HTML

I've noticed this a few times and I'm starting to think I'm missing some basic understanding. The following is a construction of HTML markup (x) which is eventually output into a div. I use getJSON to get video thumbnails for a particular product and dynamically generate a <td> block for each. But nothing in that JSON loop makes it to th...

Dumb qestion: how get json to read html??

I'm very new to Json and JQuery. I got autocomplete Jquery UI plugin that return a Json Object. Ex it return ["Tim ferriss","stack overflow","<strong>Oscar</strong> Wilde"] In the browser the strong tag is seen as &lt;strong&gt;Osca&lt;/strong&gt;r Wilde Why? I think is a very stupid error.. Edit: Nothing worked so far.This is the code...

JavaScript - How escape quotes in a var to pass data through Json

Hi I'm passing some data through Json to a Webservice. My problem is that i'm passing html (from a tinyMCE input), so the var has content using quotes and that's giving me problems. I'm passing the values like this: data: '{ id: "' + news_id + '", title: "' + news_title + '", body: "' + news_body + '" }', Is there anyway to espace q...