json

Why does my REST request return garbage data?

I am trying to use LWP::Simple to make a GET request to a REST service. Here's the simple code: use LWP::Simple; $uri = "http://api.stackoverflow.com/0.8/questions/tagged/php"; $jsonresponse= get $uri; print $jsonresponse; On my local machine, running Ubuntu 10.4, and Perl version 5.10.1: farhan@farhan-lnx:~$ perl --version This...

Philosophy of [WebInvoke(ResponseFormat = WebMessageFormat.Json)]

Hi everyone, I'm writing what I'm referring to as a POJ (Plain Old JSON) WCF web service - one that takes and emits standard JSON with none of the crap that ASP.NET Ajax likes to add to it. It seems that there are three steps to accomplish this: Change "enableWebScript" to "webHttp" in the endpoint's tag Decorate the method with [We...

Does GenerateScriptType support NonSerialized?

I have an object that's used both on the client and server side. GenerateScriptType(typeof(MyClass)) However, there are some fields that I don't need on the client, so my question is there any way to prevent those fields being serialized? (For example, Field2 and Field3 in MyClass) I tried marking the fields with [NonSerialized] but ...

Return Json causes save file dialog in asp.net mvc

Hi, I'm integrating jquery fullcalendar into my application. Here is the code i'm using: in index.aspx: <script type="text/javascript"> $(document).ready(function() { $('#calendar').fullCalendar({ events: "/Scheduler/CalendarData" }); }); </script> <div id="calendar"> </div> Here is the code for Sch...

Libraries to convert xml into JSON and vice versa.

I need to transform one document formated in xml into JSON and vice versa. I belive this is a common requirement and perhaps there's still one library that does that work. Know any? ...

Craft a JSONpath expression so that it retrieves only a specific value?

Hello, I have some JSON of which the following is a small sample: results": { "div": [ { "class": "sylEntry", "id": "sylOne", "div": [ { "class": "sT", "id": "sOT", "p": "Mon 11/17, Computer work time" }, { "class": "des", "id": "dOne", "p": "All classes Siebel 0218" } ] }, I would like to only retrieve ...

How to post json data with extJS

Greeings: I'm a bit of a newb with both extJS and json. What is the most painless route to POSTing json data using extJS? I'm not really interested any GUI features, just using the framework to send some sample data. ...

JQuery never reaches success or fail on aspx returning json.

Basicaly I have my aspx page doing <% Response.Clear(); Response.Write("{\"Success\": \"true\" }"); Response.End(); %> My JQuery code is function DoSubmit(r) { if (r == null || r.length == 0 || formdata == null || formdata.length == 0) return; for (i = 0; i < formdata.length; i++) { var fd...

GWT on Python App Engine

Hi, I have a python app engine code (matured backend) - and we are now planning to have a front end for that code. I was wondering whether it is possible to implement GWT as the front end. Even though Alex Martelli in this post [1] mentions it is not possible, a comment to that post suggests that it is indeed possible using rpc over...

JQuery and JSON - Add element

Hello, I have a JSON variable defined as: var myCollection = { "data": [ { "name":"Joe", "id":"1" }, { "name":"Bill", "id":"2" }, { "name":"Dave", "id":"3" } ] }; I have a JavaScript function that is responsible for adding items to the data element in myCollection. However, I'm not sure how to add a name/id pair to th...

net.sf.json.JSONObject adds backslashes where it's not expected ?

Hi there, I'm loosing my hair trying to figure out why net.sf.json.JSONObject add extra backslash where it shouldn't on my java code : JSONObject obj = new JSONObject (); obj.element ("column_name", "<a href=\"#\" title=\"test\">Test !</a>"); will output : <a href=\"#\" title=\"test\">Test !<\/a> with an extra "\" near <\/a>. How...

Send large JSON data to WCF Rest Service

Hi I have a client web page that is sending a large json object to a proxy service on the same domain as the web page. The proxy (an ashx handler) then forwards the request to a WCF Rest Service. Using a WebClient object (standard .net object for making a http request) The JSON successfully arrives at the proxy via a jQuery POST on th...

eval "the serialized object using JavaScriptSerializer()" after removing special characters

I need to eval an JavaScriptSerializer() object. var userSettings = '<%= new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(ViewData["UserSettings"]) %>'; The above line gives the output as: {"SalesTaxPercentage":7.75,"StartOfWeek":"SUNDAY","NoofRowsInList":10,"ShowDashboardEntry":5,"DisplayContactsFormat":"LastName...

Should I go for Arrays or Objects in PHP in a CouchDB/Ajax app?

I find myself converting between array and object all the time in PHP application that uses couchDB and Ajax. Of course I am also converting objects to JSON and back (for sometimes couchdb but mostly Ajax), but this is not so much disturbing my workflow. At the present I have php objects that are returned by the CouchDB modules I use an...

PHP, MySQL, jQuery, AJAX: json data returns correct response but frontend returns error

Hi all, I have a user registration form. I am doing server side validation on the fly via AJAX. The quick summary of my problem is that upon validating 2 fields, I get error for the second field validation. If I comment first field, then the 2nd field does not show any error. It has this weird behavior. More details below: The HTML, JS...

Building json from folder structure and vice versa

Hi, I'm trying to generate a json representation from a folder structure. Examplee folder/file structure: folder |_ meta.xml |_ subdir1 |_ textfile1.txt |_ subdir2 |_ textfile2.txt Manually generate the json representation of this structure: def builder = new net.sf.json.groovy.JsonGroovyBuilder() def json = builder.dir { ...

ruby hash to object - Parsing data from JSON object

Hi all, I'm just starting to dabble in consuming a JSON webservice, and I am having a little trouble working out the best way to get to the actual data elements. I am receiving a response which has been converted into a ruby hash using the JSON.parse method. The hash looks like this: {"response"=>{"code"=>2002, "payload"=>{"topic"=>[...

Overriding as_json has no effect?

I'm trying to override as_json in one of my models, partly to include data from another model, partly to strip out some unnecessary fields. From what I've read this is the preferred approach in Rails 3. To keep it simple, let's say I've got something like: class Country < ActiveRecord::Base def as_json(options={}) super( :o...

jQuery does not return a JSON object to Firebug when JSON is generated by PHP

The contents of test.json are: {"foo": "The quick brown fox jumps over the lazy dog.","bar": "ABCDEFG","baz": [52, 97]} When I use the following jQuery.ajax() call to process the static JSON inside test.json, $.ajax({ url: 'test.json', dataType: 'json', data: '', success: function(data) { $('.result').html('<p...

Spring Webservices and Json

Hi Is it possible to send json and receive json using spring webservices? Thanks Damien ...