json

JSON and whitespaces in identifiers

Question: The JavaScript code below: records is JSON serialized data. I can access it right away from JavaScript by using for example alert(records.data[0].Phone); The problem now is that some bright spark used a whitespace in FirstName and LastName, which means I would have to access it like alert(records.data[0].Last Name); Which...

JSON and XMLHttpRequest ?

Question: I'm trying to use JSON, but all i find is JSON parsers, which I don't need... I've read that with JSON, you can do cross-domain requests. but all I see is implementations that use XMLHttpRequest... - which means you can't use cross-domain requests, at least not outside IE... I've been on http://www.json.org/, but all I find ...

Is there an example on how to use Spring 3.0 content negotiation for RESTful services?

I was reading the Spring 3.0 Documentation and Blog Posts (followups) on how to create REST style services with Spring MVC but I can't find any working example on how to use the ContentNegotiatingViewResolver. I have a test controller like this @Controller public class IndexController implements Serializable { @RequestMapping("/inde...

jQuery: serializing hierarchical structure to Json

Let's say I have a nested unordered list that I would like to serialize to json. What is the best approach to this using jQuery? Here is the solution if anybody needs it: $(document).ready(function() { var root = $('#root'); var jsonObj = {}; jsonObj["root"] = processNode(root); var JSON = $.toJSON(js...

ASP.NET WebService is Wrapping my JSON reponse with XML tags.

I'm not sure where I'm going wrong of what I'm missing. I'm building an ASP.NET 2.0 (on the .Net 3.5 framework) Web application and I am including a webservice. Note that this is not an MVC project. I wish to expose a method which will return a JSON string; formatted to feed the jqGrid jQuery plugin. This is the preliminary test metho...

Passing JSON to a PageMethod that expects a List<T> parameter

I have an ASP.NET PageMethod with the following signature: <WebMethod()> _ Public Shared Function SaveCodes(ByVal codes As List(Of Code)) As String I am trying to pass a JSON object to the PageMethod from the client side, but I get an error that the type String cannot be converted to type of List<Code>. Here is the json that I'm buil...

Parse data returned from j.mp

Hi, I'm currently writing an iPhone application, that posts a long url to j.mp (bit.ly). It is fully working and posts the long url successfully. But when I want to copy the returned data into an UITextView, I just get some JSON Data. Now my question: How can I parse this data, so that I only have the shortened url? Could anyone help m...

Parsing JSON without quoted keys

I understand that in JSON, keys are supposed to be surrounded in double quotes. However, I'm using a data source which doesn't quote them, which is causing the Ruby JSON parser to raise an error. Is there any way to perform 'non-strict' parsing? Example: >> JSON.parse('{name:"hello", age:"23"}') JSON::ParserError: 618: unexpected token...

Javascript JSON key value coding. Dynamically setting a nested value.

I'm working on a little library that lets me do some basic key value coding w/ JSON objects. Say I have the following JSON array: var data = { key1: "value1", key2: { nested1: 1, nested2: "wowza!" } }; And I have the following javascript function: var setData = function(path, value) { eval("data." + path + "= value;"); }; And ...

Parse JSON with R

I am fairly new to R, but the more use it, the more I see how powerful it really is over SAS or SPSS. Just one of the major benefits, as I see them, is the ability to get and analyze data from the web. I imagine this is possible (and maybe even straightforward), but I am looking to parse JSON data that is publicly available on the web....

Filtering parts or all of request URL from rails logs

Rails provides filter_parameter_logging to filter sensitive parameters from the rails log. If you have a a JSONP API, some sensitive information could be present in the URL. Is there a way to filter request URLS from the log also? ...

.getJSON call to URL

I'm a little confused as to what exactly is going on here. For instance... http://bidstick.com/latest/21249%7C21250%7C21252.js&amp;localtime=1263468042061/ Is pulling down some JSON information, and the numbers being passed are specifying which auctions need information, but what is processing these variables. Is there some server side...

Parse a flat Json list into a nested <ul> using Jquery

Hi, I'm trying to render a flat Json obect into a tree like <ul> using jquery. This is what the Json object looks like [ {"FacetTypeId":1,"ProductId":22,"FacetName":"Gender","FacetSysName":"Gender","FacetTypeName":"Mens","FacetTypeSysName":"Mens"}, {"FacetTypeId":6,"ProductId":22,"FacetName":"Size","FacetSysName":"Size","Facet...

Exception with lambda express

Hello, I have a strange behavior. The code below worked from a long time but nowI don't know why I didn't change anything, I have an exception. I get employee from my database via Nhibernate, the _model.List have the employee list. I have an exception on the line juste before the return (where I build the array). I format the data to us...

PHP: parse JSON from jQuery

I'm trying to parse a simple JSON string, but I'm not used to do it from PHP. To do my testo I've wrote a js page where the data is created, sent to php page and returned back to do some test. how can I access to json data from PHP and return them back? the string from jQuery: var json_str = '{"id_list":[{"id":"2","checked":"true"},{"...

DOJO StoreExplorer not displaying correctly

I have a very simple example of an html that calls a jsp page that returns a very simple JSON object. My problem is that what I expect the screen to show is not being displayed. Here is a screen shot of what I see. screen shot link Here is the relevent parts of the HTML file. <script type="text/javascript" src="resources/dojo/...

JSON Best Practice for Property Names

Is it "best practice" to use a GUID as a property name? (see sample JSON below) { "ErrorType": 0, "I9e4f0477549111d997e0acd5cbb90d3f": { "statusCode": "0", "guid": "I9e4f0477549111d997e0acd5cbb90d3f", "moreProperties": "more values" }, "N51D209F0505711DEA52DFAD621371B7C": { "statusCode": ...

How to HTMLEncode arbitrary datasets returned from ScriptService

I've exposed an ASP.NET ScriptService that returns the results of a user defined query. In this case, I'm returning the resulting dataset as a JSON serialized IEnumerable<IDictionary>. Each IDictionary represents a dataset row and contains an arbitrary number of key/value pairs. Although most returned values are primitive types, occasi...

Json: parse to display in HTML using JQuery

I'm trying to parse data from a page of JSON in my ASP.NET MVC 1.0 web application. I need this data to display in a table on page load and I'm having a great deal of trouble mainly because I've never used JSON before. The JQuery site gives pretty terrible examples as well. This is what I have so far, I need help writing a function: ...

Please explain JSONP

I don't understand jsonp. I understand JSON. I don't understand JSONP. Wikipedia is the top search result for JSONP. It says JSONP or "JSON with padding" is a JSON extension wherein a prefix is specified as an input argument of the call itself. Huh? What call? That doesn't make any sense to me. JSON is a data format. There's no ca...