json

how to use same json for populating two combobox?

I have two combobox and one url which is sending me json data to populate inside the combobox. How can I use same url to populate the combobox. `Can I use` $(".loctype").autocomplete({ source: function(request, response){ $.ajax.. } }); I am not sure whether this is possible or not. I will appreciate if someone point me toward ri...

JSON with php and Jquery

Hello, I like to work with JSON and jquery. When I test the script offline on localhost it works fine, but when I change this json file to a server it doens't work al all jQuery(function($) { $.ajax ({ type: "GET", url: "test.php", contentType: "application/json; charset=utf-8", dataType: "j...

In Rails, why the non-parallelism for "render :json => @data" and "render :xml => @data.to_xml" ?

In Rails, we can respond_to do |format| format.html format.json { render :json => @data } end so it knows to automatically show the @data in json format, but when it is xml, it needs to be format.xml { render :xml => @data.to_xml } why does it need to explicitly convert @data into XML? Can't it be just like json's case? to...

Java HashMap vs JSONObject

I am wondering about the performance of Java HashMap vs JSONObject. It seems JSONObject stores data internally using HashMap. But JSONObject might have additional overhead compared to HashMap. Does any one know about the performance of Java JSONObject compared to HashMap? Thanks! ...

Does an application, extension, or website for finding JSON element IDs exist?

I googled a bit with no luck. I'm wondering if a tool exists that allows a user to paste in a chunk of valid JSON, click on any of its elements, and get returned the id (path) to that element. I prefer either a web app, a Chrome extension, or a OSX or X11 app. Windows would be last resort as I'd have to run it under Crossover. I could al...

What new(er) technologies does Google Instant Search use?

Is Google Instant search using Google Wave DOM diffs or something?(or maybe they are using Etherpad based tech) for speed? does it reuse/create elements with xpath? whats the speedup? what else that's interesting is going on? ...

json data returns invalid label error

I'm using Ajax file upload function with its javascript / jQuery library. When uploading a file, I keep getting this error message: SyntaxError: invalid label This is my JS script: jQuery('.uploadImage').live('click',function() { ajaxFileUpload(); }); (...) function ajaxFileUpload(){ jQuery.ajaxFileUpload({ ...

Serialize complex form to JSON object using jQuery.

I've been searching for hours for this and haven't found an answer. Please read through the whole question before flaming! :) I have a form similar to this: <form id="sample"> <input name="name" type="text" value="name value" /> <input name="phone[0][type]" type="text" value="cell" /> <input name="phone[0][number]" type="text" valu...

Getting json response into a javascript array

Hi all, If I have the following function that iterates through a json response object (val2): function test(val2){ jQuery.each(val2.maps, function(j, val3) { maps = new Array({ id: val2.maps[j].id, parent: val2.maps[j].parent, image: val2.maps[j].image, data: val2.maps[j...

Django, Javascript, JSON and Unicode

I have a frustrating problem. I have a Django web app. The model contains various CharField columns. When I convert these strings into JSON using json.dumps, the strings come out as Unicode like this: "{'field': u'value'}" and so forth. However, I need to pass this to Javascript, and the jQuery parser croaks on this format. What I am ...

eval responseText/responseXML performance

Does anyone readily know if using eval() and responseText (using JSON) is faster or slower than just using responseXML? I would imagine avoiding the eval() and using responseXML instead would be faster, despite the fact that you gotta write really long code to actually get the values of the XML. Thanks. ...

How Do I support JSON with circular references using jQuery and ASP.NET MVC?

In brief, I'm looking for a way move complex object graphs between browser code (jQuery) and server code (ASP.NET MVC). JSON does not support object references, so standard serialization of a circular referencing object is not possible out-of-the-box. A proposed standard for JSON object references is floating about, which is currently ...

Entering a variable amount of data into a database with the best normalization possible

Hi guys, ok, so I have a database comprising of two tables, products and suppliers. All suppliers fill in a form and their data is then stored in the suppliers table, and the products table contains a list of all of the products, so when the supplier fills in the form, he can choose as many products as he wishes as I use jQuery JSON a...

jquery JSON making an OPTIONS request despite GET being set.

Hello, I am having an odd problem on Windows whilst using any browser. When I make a request from my local machine to an external website with a JSON file. Apache receives an OPTIONS request rather than a GET despite GET being specified. After some research it looks like a cross site request issue however, most of the articles I found w...

How to create a dynamic form?

I want to create a form consisting of checkboxes that is based on data stored in a database and accessed via a RESTful web service in JSON format. Furthermore, some of these checkboxes will need to be pre-checked, based on other data stored and accessed in the manner described above. From what I understand I can use a repeater to create ...

org.restlet: Posting JSON content against webservice returns HTTP error 411 (length required)

Simplified code example: http://pastebin.com/9ZQxSXi9 Hi I wanted to experiment with the restlet 2.0 library and the gpodder webservice but somehow i reached a point where I can't see the wood for the trees. The service in the example requires HTTP authentication and to post some JSON content to a URL. Nothing that complicated but som...

A tool to convert JSON to C struct?

I'm just wondering if anyone has already created a tool that will take a given JSON string and write the code for an identical struct in C along with the parser code specific to that struct. I'm about to do this myself using JSON-C, but I thought I'd ask first. ...

JavaScriptSerializer to serialize a javascript function name

Hello, I am using Flexigrid in my project to add a button on the grid toolbar I can use code like this: ... "buttons":[ {"name":"Modifica","bclass":"edit","onpress":"doCommand"}, {"name":"Elimina","bclass":"delete","onpress":"doCommand"} ], ... Anyway the "onpress" attribute shall contain a reference to a js callback and ...

Easy JSON encoding with Python

Hi, I'm quite new to python (I use python 3), and i'm trying to serialize a class with one string and two lists as members in JSon. I found that there's a json lib in the python standart but it seems that I need to manually implement a serialization method. Is there a JSon encoder where I can simply pass an object, and receive the serial...

check if file is json, java

Using Java is there an easy way to check whether a given file conforms to json format? Using gson, the best i can do is: private final JsonParser parser = new JsonParser(); jsonElement = parser.parse(new FileReader(fileName)); if (jsonElement.isJsonObject()) { return true; } else { return false; } Any cle...