json

Appropriate usage for JSON?

Great site! I have a question I haven't seen answered. I am very new to this, I didn't know what JSON was yesterday, so I apologize if this is a stupid question. A client has requested an JSON/XML type scheme to store data because they want a flat file to edit/update without having to deal with queries, and they want it flexible for fu...

Using the Perl module JSON to create a JSON object

I'm having a killer time trying to create a JSON object to return to a jQuery request. I'm trying to use the jQuery chained select module and I'm trying to create the JSDN object using Perl's JSON module. I have no idea what I'm doing wrong or how I can even debug it, about the best I can do is get a JS dialog box coming up with "A un...

Is there a convenient tool for viewing/analysing JSON responses?

I find it inconvenient using my browser to view JSON responses, then copy/paste the code into my editor, then have to put line-breaks in to make it more readable. It would be great to have a tool that allows me to enter a URL and receive a JSON in a more usable format, like say, a drill-down tree, or at least some color-coding of the te...

json representation for REST. File or POST form data ?

When I send a JSON representation of my entity to the server, how should the payload be delivered ? As far as I see, there are two options: as an uploaded file as the content of a POST form data The first case cannot be performed via AJAX request, as far as I see, but it seems the "right one". Do you know if there's a preferred "de f...

Iterating through/Parsing JSON Object via JavaScript

Hello, I'm having a problem with jQuery/Ajax/JSON. I'm using a jQuery ajax post like so... $.ajax({ type: "POST", dataType: "json", url: "someurl.com", data: "cmd="+escape(me.cmd)+"&q="+q+"&"+me.args, success: function(objJSON){ blah blah... } }); It's my understanding that this will return a JavaScript JSON object? Th...

json_decode on retrieved json string from mysql does not work

I have a string json that gives the following var dump: "[[{"TransactionID":"00416","OrderID":"000926","TransactionOrderItemID":"001123","LastUpdate":"2009-10-28 13:03:31","CustomerID":"184","Company_name":"Test123","Invoiced":"0","SubItemsCount":"2","ProductID":"1","ProductTypesID":"1","ProductTypeName":"Phone","ProductName":"Phone Lin...

How to index an array?

Hello! I have a multi dimensional array, like this: array('name' => array('title'=>'Title','date'=>'Created')) I store it as JSON 'array', and when I decode it, I want to reach every item by its number, so I want an indexed array. How could I solve this in PHP? Tim ...

Dynamically added HTML does not dynamically remove with JQuery in Cakephp

Hi, We have a part list in the "garagecar/view/index.ctp" view page. The part list is populated with PHP when the page is first loaded. Each part has a remove button. When the user clicks "remove", the controller link removes the part while the JQuery/Ajax removes the HTML that displays the part in the index: $html->link(__('remove', ...

How do I make a JSONP call with JQuery with Basic Authentication?

Using JQuery, how would I call a JSONP API that required basic authentication? Can I programatically handle this, or does the user have to interact and enter the username and password into the logon dialog? ...

Get json data via url and use in python (simplejson)

I imagine this must have a simple answer, but I am struggling: I want to take a url (which outputs json) and get the data in a usable dictionary in python. I am stuck on the last step. >>> import urllib2 >>> import simplejson >>> req = urllib2.Request("http://vimeo.com/api/v2/video/38356.json", None, {'user-agent':'syncstream/vimeo'}) ...

jQuery - Getting returned data from ajaxStop

Hi guys Just wondering if anyone knows how I can get the returned json data from ajaxStop... I know there is a data property within event object, but it is undefined, even though data is being returned correctly... Cheers Anthony UPDATE: When using Success or complete I can see that the responseText within request is populated, b...

Objective C error during parsing JSON

What does this error mean? initializer is not constant Thank you for your help ...

Help with jQuery voting system. Trouble updating html vote count.

Hi all, I'm trying to create a Stackoverflow like voting system, and I've run into a slight problem. I have the following HTML that has jQuery onClick events wired to it: <div id="c_<%=Html.Encode(Model.C.cID) %>" class="votes"> <img src="../../Content/gfx/Up.png" class="up" alt="" /> <span class="votecount"><%= Html.Encode(M...

Data source for jQuery auto-complete plugin

Hey guys, I am using jQuery's auto-complete plugin for a simple search form. I am having trouble converting my JSON object data into an array for usage with auto-complete. My code: var listOfOrderedByNames = getAutocompleteData(); $('#OrderedBy').autocomplete(listOfOrderedByNames); function getAutocompleteData() { var output; ...

JQuery Ajax Post - JSON works with GET but NOT with POST

Hello All: I am trying to send json string to the server using jquery ajax, as below. It decodes correctly when GET is used, but does not work when POST is used. Any suggestions? $.ajax({ type: "GET", url: "../pssops21/php/insertTempTransData.php", data: 'data=' + strSelectedItems, dataType: 'json', async: false, success:...

ExtJS - SyntaxError: missing ) in parenthetical

I am writing some code to educate myself in the ways of ExtJS. I am also new to JSON so hopefully this question will be easy for you to answer. I am trying to retrieve some data from a basic web service that I have written which should be returning its results as JSON (seeing as I am new to JSON - it could be that that is broken). The e...

Javascript Date and JSON DateTime

I have a problem with Jquery function getJSON, the action url does not trigger because one of the parameter i am passing is a javascript date but the action expects c# DateTime.. Is it possible to format the Javascript Date to make it compatible for c# DateTime? ...

mutidimensional array from javascript/jquery to ruby/sinatra

Hi, how do I pass a 2-dimensional array from javascript to ruby, please? I have this on client side: function send_data() { var testdata = { "1": { "name": "client_1", "note": "bigboy" }, "2": { "name": "client_2", "note": "smallboy" } } consol...

Why do people want to deliver both Json and XML as output to their REST interfaces?

I understand why "REST framework" vendors want to provide the support for returning both Json based representations and XML based representations, but why do people want to return both from the same service? Is it because you will have client applications that are built on a platform that has no available Json parser? Is it beca...

Javascript Multi-level array of JSON objects - how to access key-value pair in second level or higher

Consider the following array of JSON objects: myList = [ {title:"Parent1", children:[{childname:"Child11"}, {childname:"Child12"}], cars:[{carname:"Car11"}, {carname:"Car12"}] }, {title:"Parent2", children:[{childname:"Child21"}, {childname:"Chil...