json

JSON.net problem with JsonConvert.DeserializeObject

Hi I have the following code and json: public class Labels { public Labels() {} public Label[] Label {get;set;} } public class Label { public Label() { } public string Name { get; set; } public int TorrentsInLabel { get; set; } } //... Labels o = JsonConvert.DeserializeObject<Labels>(json); //... {"labe...

Problem with JSON in Grails

Hi folks. Im toying with grails but i'm having troubles when render JSON in the controller, i have this code import grails.converters.* class CourseController { def index = { redirect(action:list,params:params) } // the delete, save and update actions only accept POST requests static allowedMethods ...

Sending a Hashtable to a Webservice

Im trying to send a List of Items with generic Keys and Value Types to a asp.net webservice. How can i do this? I tried it with List<Dictionary<String, String>>, but this doens't work. I do not get an exception, but when i break in the webserivice, my collection is null. The Data could look like this: {"Data":{"fieldtype":"integer","isr...

parse json array wich contains sql array

Hello, I am still searching for an answer but I haven't come up with a solution yet My question: How can I parse the json array I send it like this $data= mysql_fetch_array($r); header('Content-type: application/json'); ?> { "check": "<?php echo $check?>", "productcode": "<?php echo $code?>", "values": [<?php ech...

blogger jquery call

Hello, I have a blog on google (blogger) and i want to get json data from external website in order to integrate into my posts. I used jquery library and getJson function in order to retrieve the json data but nothing is returned. Blogger restrict any jquery external calls ? Have any idea? Thank you ...

Jquery Ajax, missing ; before statement

I have a jquery ajax call that is making a cross-domain request. all the js syntax looks good, and the response looks good, but i keep getting the "missing ; before statement error" in firebug (console). Here's my web service: [WebMethod()] [ScriptMethod(ResponseFormat = ResponseFormat.Json, XmlSerializeString = false, UseHttpGet = tr...

Is there an extension to reindent JSON in Notepad++?

I need Notepad++ to take a json string from this {"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}} to this... {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ ...

Cocoa JSON - Check whether array or dictionary

Hi, I am using the Cocoa JSON framework ( http://code.google.com/p/json-framework/ ) to communicate with an API. The problem is that the API returns a dictionary if there is an error but returns an array of the results if it works. Is there a good way to detect if the JSONValue is an array or a dictionary? Thanks. ...

jquery $.post function's result data

When I make an ajax call (see code below), what is "data". How do I set and get data // $.post() $("#post").click(function(){ $("#result").html(ajax_load); $.post( loadUrl, {language: "php", version: 5}, function(data){ $("#result").html(data); }, "j...

How can I get a JSON object from a SQL Server table?

I have a view that I want to be converted into JSON. What is the SQL that I can use to produce on the server the JSON string needed to be returned? ...

mochijson2 or mochijson

Hi guys. I'm encoding some data using mochijson2. But I found that it behaves strange on strings as lists. Example: mochijson2:encode("foo"). [91,"102",44,"111",44,"111",93] Where "102", "111", "111" are $f, $o, $o encoded as strings 44 are commas and 91 and 93 are square brakets. Of course if I output this somewhere I'll ...

jQuery: How to stop AJAX function escaping JSON string used to POST data

I need to serialize all inputs from a form into a JSON string. With the help of this post, I can successfully create a valid string as below: {"input01":"value01","input02":"value02","input03":"value03"} However, when I try to use the string to POST data using jQuery's Ajax function, it seems to add backslashes to the string, resultin...

Ext.Direct grid problem

(i posted this on the extjs forum too but recon SO is probably busier) HI I'm passing down the following json to a direct store: { "type": "rpc", "tid": 2, "action": "DirectReportDesigner", "method": "GetReports", "result": { "total": 1, "data": [{ "id": 1, "FullTypeName": null, "title": "test", ...

Best way to use jQuery's .ajax() function retrieve variables from a php script?

-I have read about json being a simple way but also read its a bad practice to use eval() once the data is retrieved. So I don't know how so use the data returned. -The only way i've been able to retrieve data from php scripts is if I echo the results already formatted (which is not very convenient). Also if there is a redirect in the p...

How do I consume a web service in objective c?

I have a web service developed in coldfusion that I am trying to consume on the iphone. The web service returns JSON which should be fairly simple to read. However, I have been unable to find a good simple example of an iphone app calling a web service and using the data. Are there any good tutorials or examples out there that I am just ...

How can I suppress \\ in my output from Perl's JSON module?

Following code always print paths with double slashes: use JSON; use File::Spec; my $installdir = $ENV{"ProgramFiles"}; my $xptrlc = File::Spec->catfile($installdir,"bin","sample"); my $jobhash; my $return_packet; $jobhash->{'PATH'} = $xptrlc; $return_packet->{'JOB'} = $jobhash; my $js = new JSON; my $str = $js->objToJson($return_p...

JSONArray with Java

hey, i'm just getting started with using json with java. i'm not sure how to access string values within a JSONArray. for instance, my json looks like this: { "locations": { "record": [ { "id": 8817, "loc": "NEW YORK CITY" }, { "id": 2873, "loc": "UNITED STATES" }, ...

Jquery Each Json Object

I have a result set returning from a service that gives me the following json { "ThreadCount":61, "GroupList":[ {"userName":"KLT","count":2687}, {"userName":"KCameron","count":718}, {"userName":"IRG","count":156},{"userName":"JLB","count":123},{"userName":"HML","count":121},{"userName":"SMN","count":99},{...

.net JSON serializer returns local client time to browser?

I use an asp.net [WebMethod] to push a .net object back to the Ajax call on a browser. One of the properties of the object is of a DateTime type. When it arrives at the browser the time is seven hours before the time that is stored in the SQL Server. Okay, so my browser is in Peru (GMT-5) and the server is in Germany (currently GMT+2), ...

How to access JSON.parsed object in javascript

Hi, I did JSON.parse & getting output in javascript variable "temp" in format like this {"2222":{"MId":106607, "Title":"VIDEOCON Semi Automatic Marine 6.8kg", "Name":"washma01", }} I tried like alert(temp[0][0]); alert(temp.2222[0].MId); but not getting out put. How will i access this data in java script ? ...