json

events not registering after html being generated with $.post callback

I have some input checkboxes that are being dynamically generated in a $.post callback function. Then i have a $().change() call that does things when the value is changed (alerts some info). However, for the dynamically generated inputs, the .change() does not work. There are other inputs that work that are hardcoded into the html that ...

Using JSON in a Yahoo! widget

Haaylp! The Yahoo! Widgets spec says I can parse JSON objects using JSON.parse(). When I actually try this, and here is what I tried... var parsed = JSON.parse('{"key": "value"}'); print (parsed); for (p in parsed) { print ("prop: "+p); } I get: ReferenceError: JSON is not defined What's going on? Is further magic required? ...

JQuery getJSON - ajax parseerror

I've tried to parse the following json response with both the JQuery getJSON and ajax: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview</h1><h1>January 29, 2009</h1>"}] I've also tried it escaping the "/" characters like this: [{"iId":"1","heading":"Management Services","body":"<h1>Program Overview <\/h1><h1>J...

"Walk" JSON response and populate form fields -- more efficient approach?

I know there is a far more elegant/efficient way of doing this (in php I would use foreach) but with jQuery how can I walk the var/val pairs of a JSON response and populate form fields with the same id's as the field names in the JSON response? Here is my JSON response: [{"field":"svendor_name","value":"Vendor Name Inc."},{"field":"sve...

How do you write in JavaScript a empty key from JSON?

Hello todos! Let's say you have the following JSON object {"":"some text"} How do you retrieve it in JavaScript? json_in_var={"":"some text"} alert(json_in_var.) I'm perplexed on this one, any help welcome! ...

How to build a tree control with JSON and jQuery

I have a web page on which I would like to display dynamically a tree based on a JSON array with the help of jQuery. Each node of my tree has a checkbox associated to it. When I click a node which has children, I would like all of them to be checked. I’ve already taken care of printing the tree and the checkboxes and I am now trying to s...

JSON parsing with XML containg XML

I have a ‘workitem’ (cut down xml) which contains the following: <dataModel> <outputs name="CustomerId" type="string" value=""/> <outputs name="City_and_State" type="string" value=""/> <outputs name="CustomerName" type="string...

How do I properly format this json object in PHP

I need to be able to create a data structure in PHP which creates for instance, an array of car vendors. Each of those arrays, has child arrays which are types of cars for that vendor. So you'd have something like $cars['toyota'] = array("camry", "etc"); I need to be able to create this data structure in PHP so that on the JavaScript ...

Is there a simple library that will render JSON objects as trees?

So, is there a VERY simple library that will render JSON objects as trees? I know that this can be done in many ways (such as YUI), but for debug purposes I'd like to simply be able to view a JSON objects I receive from a server as a tree, nothing fancy (but collapsable tree's would be a bonus). The kind of solution I'm looking for wou...

Are there any good splash ad scripts out there?

I am using a splash page for a random full page ad. It was downloaded from dynamic drive web site, but it wont work. Can any body show me any other scripts for splash page ad display. ...

Ajax Cross Domain Calls

Can we make Ajax request to a different instance of server(different port) running on the same machine ...

In jQuery, I am returning HTML in a JSON result, what do I have to escape?

In my Ajax request (using jQuery) I am returning a JSON response. So json.Html will have a string of HTML I want to append inside a div. On the server side, do I have to escape the HTML at all? In my MVC action, I am returning: return Content("{html: ???????}, "application/json"); ...

How should the Request Body look like?

I have a WCF service with a method which looks like this (returns null for testing with the debugger, I care only about getting data in for now): [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "fares", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedReq...

JQuery/WCF without ASP.NET AJAX:

Hi, I am proper struggling getting that "magic" moment when WCF is configured nicely and jQuery is structuring its requests/understanding responses nicely. I have a service: <%@ ServiceHost Language="C#" Debug="true" Service="xxx.yyy.WCF.Data.ClientBroker" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %> Thi...

Serialize Entity Framework objects into JSON

It seems that serializing Entity Framework objects into JSON is not possible using either WCF's native DataContractJsonSerializer or ASP.NET's native JavaScript Jersializer. This is due to the reference counting issues both serializers reject. I have also tried JSON.Net, which also fails specifically on a Reference Counting issue. My ob...

Is gzip encoding compatible with JSON?

I'm trying to narrow down some weirdness going on with my AJAX calls. My PHP scripts have this at the start: ob_start("ob_gzhandler"); Works great with HTML. But are there any problems with doing it with application/json data? Any browser issues anyone is aware of? ...

Deserializing from JSON into PHP, with casting?

Suppose I have a User class with 'name' and 'password' properties, and a 'save' method. When serializing an object of this class to JSON via json_encode, the method is properly skipped and I end up with something like {'name': 'testName', 'password': 'testPassword'}. However, when deserializing via json_decode, I end up with a StdClass...

Is there a library to convert Java POJOs to and from JSON and XML?

I have an object graph that I would like to convert to and from JSON and XML, for the purposes of creating a REST-style API. It strikes me that someone must have done this already, but a quick search using Google and Stack Overflow reveals nothing. Does anyone know of a suitable (Apache or equivalent license preferred) library to do th...

ASP.Net MVC Json Result: Parameters passed to controller method issue

I'm having a problem getting a controller method that returns a JsonResult to accept parameters passed via the JQuery getJSON method. The code I’m working on works fine when the second parameter ("data") of the getJSON method call is null. But when I attempt to pass in a value there, it seems as if the controller method never even gets ...

convert csv/xls to json

Does anyone know if there is application that will let you covert preferably xls to JSON. ill also settle for a converter from csv since thats what ill probably end up having to write myself if there is nothing around. ...