json

How can I escape colons when jQuery loads json and there are colons in the json data?

So I am loading some Json that is transformed from RSS beforehand. This RSS has colons in it's namespaces and the conversion script doesn't strip them. JQuery loads the json file fine, but when I try calling anything with the colon in it's name like alert(data.rss.channel.item.kuler:themeItem.kuler:themeSwatches.kuler:swatch[0].kuler:...

Noob: How to decode JSON with Python

I'm getting my JSON from reddit.com, essentially something like this. I have done quite a bit of reading, but I don't really understand how I can grab the information I want from this JSON (I want a list of the story links). I understand that I can "decode" the JSON into a dictionary, but do I need to recur throughout the JSON to get wha...

Looping Through Multiple JSON Requests (YouTube Data API)

Part of a website I am working on is a video page. I am pulling the videos from a YouTube account by accessing the YouTube Data API. Grabbing the videos in no particular order and not sorted works fine, but when I try to sort them into categories, I start running into trouble. Let's say there are three categories, Fruit, Vegetable, Pets....

string to json and check json key -value

{"loggedin":0,"error_message":"login_failed","success_message":"","username":"","sessionId":""} this my json in string format, i have to check in javascript that loggedin value 0 or 1 ...

rails // format.js or format.json, or both ?

might be obvious, but still i'm lacking here of basic knowledge. so inside controllers, can both be used, or is it always javascript, so both are the same ? ...

JSON data response from PHP server is empty

I'm having a hard time figuring this one out. Seems like no matter what I try, PHP always ends up returning an empty array. Here's the code of my main file(index.php): <script language="javascript" type="text/javascript"> $(document).ready(function(){ $(".ajaxlink").click(function() { callServer(); return false; //Stop link ...

Use greek with JSON

This is a JSON I'm writing and use it with JQuery. bookData.webSites = [ { id: 1, title: "ΤΟΥΡΙΣΤΙΚΗ ΑΝΑΠΤΥΞΗ", image: 'images/books/min.png', site: 'http://delicious.com/', author: "", pages: '', isbn: '', price: '', type: 'book' }]; It works perfect unt...

IE 6 doesn't load other Flickr photos from photo stream

I checked this in firebug lite, and it's loading everything into the DOM properly, but immediately hangs on the second image. When I try visiting the images individually they don't load either. Any ideas? I should also point out that this script works fine in: IE7, IE8, Firefox 2,3, and Safari. $(document).ready(function() { var reg...

How divide a string into array

If I have the following plain string, how do I divide it into an array of three elements? {["a","English"],["b","US"],["c","Chinese"]} ["a","English"],["b","US"],["c","Chinese"] This problem is related to JSON string parsing, so I wonder if there is any API to facilitate the conversion. ...

json parse error in ruby - unexpected token at

Hi, I get errors at a lot of places when trying to retrieve ticker symbols for US companies from http://d.yimg.com/autoc.finance.yahoo.com/autoc?callback=YAHOO.Finance.SymbolSuggest.ssCallback&amp;query=Wal-Mart I have tried to: resp = Net::HTTP.get_response(URI.parse(url)) data = resp.body qwe = data.split("symbol") p qwe[1] arr1 = ...

JQuery Cycle and JSON with JQuery

Hi everybody, I found the jQuery Cycle plugin which is very interesting. So, there is the following script that should return the images: $(function() { // retrieve list of slides from server $.getJSON('slidelist.php', startSlideshow); function startSlideshow(slides) { /* server returns an array of slides which looks like this...

C# Webservice: Throw exception with extra properties in JSON

I have a webservice written in C#. When errors occur on the server, I would like to inform the user client side. This works fine by throwing exceptions server side, which is then sent to my error handler client side. However, I would like to, when I throw the exception, to set a property describing how serious I think the error is at th...

jquery loop on Json data using $.each

Hi I have the following JSON returned in a variable called data. THIS IS THE JSON THAT GETS RETURNED... [ {"Id": 10004, "PageName": "club"}, {"Id": 10040, "PageName": "qaz"}, {"Id": 10059, "PageName": "jjjjjjj"} ] and I am trying to loop through the collection using $.each but I am running into problems where the alert is showing ...

Firefox search plugin: varying result destination URL based on results returned?

I want to create a firefox search plugin with an autocomplete function. However I have a twist to the standard, "return a result and append to the URL" method. Depending on the result returned in the autocomplete how do I use a different "template URL" (or destination URL) when the user submits the search? Can you return a result and ...

Easiest way to serialize a simple class object with simplejson?

I'm trying to serialize a list of python objects with JSON (using simplejson) and am getting the error that the object "is not JSON serializable". The class is a simple class having fields that are only integers, strings, and floats, and inherits similar fields from one parent superclass, e.g.: class ParentClass: def __init__(self, ...

How do I override the RJS MIME Type in Rails 2.3?

I have an app running Rails 2.3.5 that has a JSON API for much of it. A contractor came in and did some work on the app and used RJS in a few places. Some of those controller actions that are using RJS for the main web site also need to be part of the API. The problem is that JSON API requests trigger the RJS responses, which is not w...

Have you found any bugs in Native JSON implementations?

What bugs, if any, have you found in the current batch of native JSON implementations? FYI - this is meant to be a sort of central repo of native json bugs. The reason I feel this is important is that the de-facto standard, json2.js, does not install itself if it finds a native implementation, so it is crucial to identify native bugs ...

how to insert a converted array to mysql? (Php)

I have converted a json data to array but now i wanted to insert it into my database i keep getting Array here is the code for ($i=0; $i<=$checking; $i++) { $catid = $ids[$i]; $catname = $names[$i]; $catapps = $apps[$i]; $caturl = $iconurls[$i]; $query = "INSERT INTO cat VALUES ('".$catid."','".mysql_real_escape_...

parsing specific values in JSON for ajax

I was given this code earlier but am having a hard time parsing the correct data. I have the following JSON { flavors: [{"image":"images/bbtv.jpg", "desc":"BioBusiness.TV", "id":"1"},{"image":"images/grow.jpg", "desc":"Grow Staffing", "id":"2"}]} and I want to only show id:1 or id:2. I have the following code for Ajax $.ajax({ ...

Detect bad json data in PHP json_decode()?

Hi there, I'm trying handle bad json data when parsed through json_decode(). I'm using the following script: if(!json_decode($_POST)) { echo "bad json data!"; exit; } If $_POST equals: '{ bar: "baz" }' Then json_decode handles the error fine and spits out "bad json data!"; However, if I set $_POST to something like "invalid dat...