json

Cannot call webmethod with jquery json

Hi, I use the protocol jsonp to call web methods, but i have this problem: Have this code on the webservice: public class Service1 : System.Web.Services.WebService { [WebMethod] [ScriptMethod] public string HelloWorld() { return "Hello World"; } } And this on Jquery with jason on client side: $.a...

Having trouble converted a scala case class to json JObject when it contains an field of type Enumeration

In Scala 2.8 and liftweb.net 2.0 I'm trying to serialize a case-class to Json but when the case class has an enumeration in it it fails. import net.liftweb.json.DefaultFormats import net.liftweb.json.Extraction._ import net.liftweb.json.JsonDSL._ import net.liftweb.json.JsonAST.JObject // Enumerated type object ColorType extends scal...

How to return a specific Json in ASP.NET MVC?

Hello guys, I'm using this plugin http://devthought.com/projects/jquery/textboxlist/ to autocomplete like Facebook Style. I'm just a bit confuse on how to return the Json result that fits the plugin's need. The json result must be like this: [[1, 'John', null, ''],[2,'Mary', null, ''],[3,'Mark', null, '']] The problem is when I retur...

My use of Haskell's Text.JSON considered ugly?

What I am trying to do is really simple. I'd like to convert the following JSON, which I'm getting from an external source: [{"symbol": "sym1", "description": "desc1"} {"symbol": "sym1", "description": "desc1"}] into the following types: data Symbols = Symbols [Symbol] type Symbol = (String, String) I ended up writing the follo...

Parsing a JSON object with jQuery and creating two drop down lists with that data

Hi guys, I am trying to dynamically create two drop down lists, one will be provinces, and the other will contain the cities of each province, so when a user chooses a province, the cities drop down will populate, I am using jQuery's $.ajax funtion to get the data from a database which then passes it back as JSON, here is what I have thu...

Creating JSON from a comma delimited string with PHP

Hi guys, I am trying to create JSON from a comma delimited string, the string look something like this: One,Two,Three,Four,Five,Six,Seven I need it to look something like this: [{"test":"One"},{"test":"Two"},{"test":"Three"},{"test":"Four"},{"test":"Five"},{"test":"Six"},{"test":"Seven"}] Here is the code I have thus far: $stri...

Populating a drop down list using jQuery getJSON not working

Hi guys, I am trying to send a variable with jQuery's getJSON function but it doesn't seem to be going through, I am also unsure of how to get the variable I have just sent in the waiting PHP file, do I just reference it via the name I sent it as, for instance if I send a variable called 'test', can I get it like this, $_POST['test'] on ...

How can I exclude the Type information from the DataContract?

I want to exclude the __type Key and Value from my serialization: {"__type":"Entity:#Runtime.DataBus","Children":[],"Fields":[{"Key":"field1","Value":"10"},{"Key":"fieldString1","Value":"field1 init"},{"Key":"fieldString2","Value":"field2 init"}],"Name":"Entity1"} I'm using the System.Runtime.Serialization.Json.DataContractJsonSeriali...

Staggering sqlite records with Objective C

An iphone app we are producing will potentially have a table with 100,000+ records (scaling wise) and I am concerned that loading all this data via a SELECT * command into an array, or an Object will either make the app very slow; or will leave me with memory issues later on. Obviously loading 100,000+ records into an array when the vie...

jQuery.ajax Response is empty or undefined

Hi I hava a big problem. I have to get some JSON form localhost:8080. The server side is a restful based jax-rs server. @Path( "/m" ) public class M { @GET @Path( "{id: [a-z]{1,4}-\\d{1,4}}" ) @Produces( "application/json" ) public Response getCar ( @PathParam( "id" ) final String id ) { final ResponseBuilder builder; b...

Javascript: stringify object (including members of type function)

I'm looking for a solution to serialize (and unserialize) Javascript objects to a string across browsers, including members of the object that happen to be functions. A typical object will look like this: { color: 'red', doSomething: function (arg) { alert('Do someting called with ' + arg); } } doSomething() will only...

C# Serialize Dictionary<ulong,ulong> to JSON

I am trying to serialize a Dictionary to JSON, and get the following exception: new JavaScriptSerializer().Serialize(mydict) Type 'System.Collections.Generic.Dictionary2[[System.UInt64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Nullable1[[System.UInt64, mscorlib, Version=2.0.0.0, Culture=neut...

Javascript processing Cyrillic input

When i get a json feed from a Cyrillic site, the data is in a \ufffd format instead of Cyrillic chars. (example feed: http://jsonduit.com/v1/f/l/7sg?cb=getJsonP_1284131679846_0) So when i set the source html to the input, i get weird boxes instead of characters. I tried to unescape the input but that wont work too. How do i revert the...

Jquery Autocomplete with json fails

I am using the auto complete plugin by Devbridge and I have it all installed here is my code: $(document).ready(function(){ $('#request_task').autocomplete({ serviceUrl: '<%= ajax_path %>', minChars:1, width: 300, delimiter: /(,|;)\s*/, deferRequestBy: 0, //miliseconds params: { artists: 'Yes' }, ...

How to force heroku to use JSON/ext over JSON/pure.

I've hit a stumbling block and I'm not sure how to proceed. I'm trying to get resque working with redis to go on heroku, I have it all working locally, but when I push to my staging environment and try to queue a job I get the following exception: TypeError: wrong argument type JSON::Pure::Generator::State (expected Data) On my local m...

pass an object through jquery trigger

I'm trying to do something rather simple but I'm getting a strange result. I have an event trigger that I'm using to pass a json object but when it gets through to the other side it's a function... I alert the result and it shows this: example of alert sting: alert('value of lattitude? ' + map.currentLatLng.lat); result: value o...

Alternative to Json.Net

just curious if there is an alternative solution to the Json.Net library from james newton king ...

Trying to construct a comma delimited list from an array

So i need this format json and i have this so far { query:'Li', suggestions:['Liberia','Libyan Arab','Liechtenstein','Lithuania'], data:['LR','LY','LI','LT'] } query = params[:query] artists = search_object.map{|x| x["artistName"]} @all_instances_hash = {} @all_instances_hash[:query] = query for instance in artists @all_...

how can mvc return Unauthorized code without redirecting to LogIn view

My MVC web application serves two types of users. First one over standard web browser Second one over REST returning only Json data. Both requires Authentication and authorization. Both scenarios are differentiated based on the route so that i know what content to serve. When users access the application, if they are not logIn the appl...

Is it O.K. if our RESTful Web Service doesn't support XML?

Our web service only supports JSON. We respond with JSON if we can or respond with an HTTP Error 406: Not acceptable if the client asks application/xml... Is it still considered RESTful? ...