json

Problems with $.getJSON in certain browsers

I have a php file that outputs json encoded text via echo '(' . json_encode( $final ) . ')'; And i have a javascript file that fetches that page $.getJSON(file, function(data){ var object = eval(data); alert(object); //for testing ... When any browser other than firefox 3.5 visits the page that calls .getJSON it alerts null BUT!!!...

How to create ValueProvider for MVC

I want to create a Valueprovider in ASP.Net.MVC 2 Beta. My Value source would be a JSON ...

Is it possible to get Google Maps Directions using HTTP requests?

Is it possible to use the Google Maps API router just using HTTP? Something like http://maps.google.com?from=blah?to=blah And have it return some sort of XML or JSON representing the directions? ...

Parsing json with sed and awk

I'm trying to parse json returned from a curl request, like sp: curl 'http://twitter.com/users/username.json' | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' I have it set working where it splits the json into fields, i.e. the above returns % ... "geo_enabled":false "friends_count":245 ...

Parsing and Converting TED Talks JSON Subtitles

This question is related to this other question @ SuperUser. I want to download the TED Talks and the respective subtitles for offline viewing, for instance lets take this short talk by Richard St. John, the high-resolution video download URL is the following: http://www.ted.com/talks/download/video/5118/talk/70 And the respectiv...

Retrieve values from json encoded string.

I am storing a concatenated string like this: echo json_encode($PostedDate.$Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email); I can split this string using JavaScript and store values in an array. But what I want to know is that suppose any of the values above is null, will it affect the array ...

Generate Java class from JSON?

Hi. I want utility that generates classes from JSON. For example we got "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "21 2nd Street", "city": "New York" } We pass this to our util and on exit we have something like this: class Address { JSONObject mInternalJSONObject; Addr...

Django JSON Serialization with Mixed Django models and a Dictionary

I can't seem to find a good way to serialize both Django Models and Python dictionaries together, its pretty common for me to return a json response that looks like { "modified":updated_object, "success":true ... some additional data... } Its simple enough to use either simplejson to serialize a dict or Django's serializers.seri...

Can't consume ASP.NET Web Service from jQuery

Here's an interesting problem: I have some jQuery that looks like this: $(document).ready(function() { $.ajax({ type: "POST", url: "http://localhost:63056/Service1.asmx/PrintOrderRecieptXml", data: {"CouponCode":"TESTCODE","Subtotal":14.2600,"ShippingTotal":7.5000,"TaxTotal":0.0000,"GrandTotal":21.7600,"Ord...

Python JSON serialize a Decimal object

I have a Decimal('3.9') as part of an object, and wish to encode this to a JSON string which should look like {'x': 3.9}. I don't care about precision on the client side, so a float is fine. Is there a good way to serialize this? JSONDecoder doesn't accept Decimal objects, and converting to a float beforehand yields {'x': 3.899999999999...

validation using jquery while saving on Json

How to validate fields using regex while saving on Json. ...

Get values from JSON encoded array string.

My .php code in a file "fetchvalues.php" looks like this: echo json_encode(array($PostedDate.Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email)); This file is called by another file and the calling function looks like: $(document).ready(function(){ $("#Edit").click(function(){ $.getJSON(...

Return complex object from an AJAX call

Hi Environment used: ASP.NET, jQuery I have the following AJAX call: var tempVar = JSON.stringify({plotID:currentId}); $.ajax({ type: "POST", url: "testPage.aspx/getPlotConfig", data: tempVar, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg)...

Button click not working

The following code was working very well. Suddenly, the Edit button click stopped working. When the user used to click Edit button, a JSON code executed. But it is not recognizing the click now. Something happened accidentally? Please assist. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <...

How to best store a large JSON document (2+ MB) in database?

What's the best way to store large JSON files in a database? I know about CouchDB, but I'm pretty sure that won't support files of the size I'll be using. I'm reluctant to just read them off of disk, because of the time required to read and then update them. The file is an array of ~30,000 elements, so I think storing each element separ...

How to implement chat application in C# MVC application

hi I likely to integrate a chat application with my asp.net mvc (C#) application, can any one help me by sending sample source on that...and please tell that it is correct way to approch using jquery or ajax ? kindly help me with sample code. ...

Python TypeError when using json.dumps

When I do json.dumps with a dictionary that maps strings to a list of unicodes, python raises a type error. Why does that not work? ...

jquery JSON php

while ($row = mysql_fetch_object($result)) { $data[] = $row; echo "<div id='captionbox' style='width: 110px;float:left;color:#FFF;text-align:center;'>"; echo "<a href='#' class='thumb'><img class='thumb-img' value = ".$row->aid." onclick='getVote(".$row->aid.", \"".$row->atitle."\")' src='images/roadies/th".$row->aid.".jpg' ...

Recommendation for documenting JSON API?

Are there any accepted standards or best practices for documenting a set of JSON API's? Done a fair bit of searching around and there seems to be a bit of a mish-mash of style / formats. Maybe making too big a deal over this ... at some level docs is docs, but figured I'd ask. ...

PHP to Javascript Array (Kind of)

Hi, Here in an array i have in javascript, this works great! _rowData: [ { name: "Most Recent", view: "recentView" }, { name: "Most Popular", view: "popularView" }, { name: "Staff Picks", view: "staffView" } ], How could i generate this array from a php script? I want to use AJAX to get the results returned by the php. ...