json

Which Java web development framework for an AJAX application?

I read through a few threads (simple web framework, java web development, etc). Very informative. However I have not seen a focus on the AJAX side of things. For the app I am trying to create, most of the client side will be written in Google GWT, and JSON will be used to communicate with the server side. In that case, all templating is ...

JSON parse -> stringify -> parse broken?

Hi, I'm using json2.js for this: var str = '{"elements":[{"text": "", "colour": "#66AA50", "type": "line"}]}'; var obj = JSON.parse(str); var str2 = JSON.stringify(obj); var obj2 = JSON.parse(str2); Weird thing is that obj2 is a broken version of obj, i.e it's not identical to it. In ...

POSTing File Attachments over HTTP via JSON API

I have a model called Book, which has_many :photos (file attachments handled by paperclip). I'm currently building a client which will communicate with my Rails app through JSON, using Paul Dix's Typhoeus gem, which uses libcurl. POSTing a new Book object was easy enough. To create a new book record with the title "Hello There" I could...

how to pass java beans to jsp page for jqQrid to display using json?

we are trying to use jqGrid with our jsp front end and java back end. this page is displaying a grid of contacts : jQuery(document).ready(function(){ jQuery("#list").jqGrid({ datatype: 'json', url:'gridContactDrv.jsp', mtype: 'GET', height:300, width:600, colNames:['First Name','Last Name', 'Company', 'Prima...

Binary Data in JSON String. Something better than Base64

The JSON format natively doesn't support binary data. The binary data has to be escaped so that it can be places into a string element (i.e. zero or more Unicode chars in double quotes using backslash escapes) in JSON. An obvious method to escape binary data is to use Base64. However, Base64 has a high processing overhead. Also it expan...

Safely loading a hash in Ruby

I want to load a data structure into a Ruby script which maps a string to a triple which contains some combination of regular expressions, scripts and atoms. The file that it loads from needs to be human writeable. Currently I'm writing the file to contain a Ruby hash, loading that as a string and calling eval. Ie. Data file { "key1" ...

Symfony (PHP framework) and MongoDB ( or any json-based database)

I was wondering if its possible to use a json-based schema-free, document-based database like Mongodb or Couchdb on a symfony project like its used for ruby-on-rails websites? And if yes, how can it be done? ...

Daily server-side caching of 10,000 Google Maps geocoder responses

I'm currently looking into methods of implementing server-side caching of roughly 10,000 Google Maps geocoder responses in a J2EE web application. Since Google limits the number of geocoding requests to 15,000 per day, I need a method to store my requests for 24 hours. The requests originate from an XML file that sits on the server, and ...

Why does this javascript/jQuery JSON parsing code not work?

Here is my jQuery code. It should parse the json returned by this php script. The php is known to work. It should also convert the date literals to a javascript date object. However, an error occurs at dates.length. Can anyone see what is wrong with the code? if($("#calendar").length) { var dates; $.post("/dates/jsondates.php",f...

Dynamic Script Tags for JSON requests... detecting if there is a XXX error?

I do a bunch of json requests with dynamic script tags. Is it possible to detect if there's an error in the request (eg. 503 error, 404 error) and run something on detection of the error? ...

Format floats with standard json module

I am using the standard json module in python 2.6 to serialize a list of floats. However, I'm getting results like this: >>> import json >>> json.dumps([23.67, 23.97, 23.87]) '[23.670000000000002, 23.969999999999999, 23.870000000000001]' I want the floats to be formated with only two decimal digits. The output should look like this: ...

How do I convert a Dictionary<string,string> to a json string using System.Json?

Hi, I'm trying to convert a Dictionary in Silverlight to a string. I don't want to use any third-party libraries so would like to use System.Json to do this? The best way I have thought of so far is to add all the items in the dictionary to a JsonObject and then call toString(), any better ideas would be most helpful. ...

Possible to write strongly typed entity classes in javascript?

When I am retrieving JSON entities via jQuery from the server and manipulating them client side, I have this desire to be able to see their interface via Visual Studio intellisense. So, ignoring whether this is a stupid idea, is this possible in any way? So what I was thinking was being able to reference Entities.js, which would contai...

Deserializing some JSON with JSON.NET

Hi everyone! I'm very new to JSON, and I need to parse some that an API is providing. A quick google search turned up JSON.NET, so I'm trying to use it now to parse this JSON into a list object. First of all, is JSON.NET the best library to use for this? This is what I'm trying to do: I have a class called Item, for example. The json ha...

In LINQ to SQL, How to return datetime in ISO 8601 String, IETF String or timestamp?

In LINQ to SQL, how can I convert this format: "VDate(1253451600000+0200)V" to an ISO 8601 string, IETF string or timestamp format? I'm using WCF JSON-Enabled and Ajax-Enabled web service. ...

Error when trying to create json web service in asp.net

I followed this to create a json web service in asp.net 3.5: http://www.pluralsight.com/community/blogs/fritz/archive/2008/01/31/50121.aspx It works fine if I want to use it internal but as I want to connect to it external I got an error saying: "Metadata publishing for this service is currently disabled." So I tried enabling it but...

JSON: Serializing types derived from IEnumerable

JavaScriptSerializer serializes types derived from IEnumerable as JavaScript arrays. It convenient for arrays and lists but in some cases I need to serialize properties declared in derived type (e.g. Key in IGrouping). Here some sample code: var items = new[] { "aaabbb", "abcd", "bdsasd", "bsdqw" }; IGrouping<char, string> data = items....

How to decode and cast JSON string in Flex?

I'm using as3corelib to decode/encode JSON strings. In my little experiment I want to encode an object (UserInfo) to JSON string and decode it back to the object, however it seems to fail at the convertion point (the last line), why would that happen? how can I make it work? The UserInfo class public class UserInfo { public var le...

Using System.Web.Script.Serialization.JavascriptSerializer to deserialize JSON - how to?

Note: I posted a similar question, which was the ancestor of this question, as I was originally thinking of using JSON.NET to parse the JSON, but I'm using the built-in deserializer, so it's a different question. This is what I'm trying to do: I have a class called Item, for example. The json has many "elements" (if that's what they are...

Python's json module, converts int dictionary keys to strings.

I have found that when the following is run, python's json module (included since 2.6) converts int dictionary keys to strings. >>> import json >>> releases = {1: "foo-v0.1"} >>> json.dumps(releases) '{"1": "foo-v0.1"}' Is there any easy way to preserve the key as an int, without needing to parse the string on dump and load. I believe...