json

How can I store JSON data in a JS variable?

I have an ajax response which is an array passed via php's json_encode() function. Printing it directly to the browser works fine: for(var i=0; response.length; i++){ document.write(response[i].text + '<br />'); } Adding it to a javascript variable throws the error "response[i] is undefined" var str = ''; for(var i=0; response....

iPhone, JSon and Compression

Hey, I'm building an iPhone app that's going to be sending and receiving large amounts of data to and from a server. I'm using JSon to get the data. I was wondering if it's possible to also use some sort of compression on the received data in order to try to speed up the process a little bit. If so, which kind of compression works best ...

Why eval() isn't working here to deserialize such a simple JSON object?

Hi, I am trying to use eval() function to deserialize this JSON text by using eval function. var personJSON = {"FirstName":"Burak","LastName":"Ozdogan","Id":"001" ,"Department":"Information Technologies"}; var personBurakOzdogan = eval('(' + personJSON + ')'); But I am getting this error: *Microsoft JScript compilation err...

return data from jquery $.post

I want to have a simple function where i can insert a sqlQuery and get a database answer in json-format like this: function ExecuteQuery(query){ $.post("sql.php", { "query": query }, function(data){ return data; }, "json"); } The response i get is undefined, I think i have misunderstood something quite basic but i ...

Android Eclipse Error: "Gson cannot be resolved to a type"

I'm relatively new to Java, eclipse and android so this could be a completely silly question, but I'm going to ask it none the less. I've got a project I'm learning with to test connecting to the flickr api and simply displaying recent images. I'm at the point now where I want to parse the JSON received from flickr. I've downloaded gso...

Making a JavaScript script that gets out info from Youtube

Hello, so i continue from this question http://stackoverflow.com/questions/3081097/youtube-get-youtube-title-imagedescription-like-facebook` i got this answer: If you were given the video link http://www.youtube.com/watch?v=NWHfY_lvKIQ, you could get all the info about the video by using this link, http://gdata.youtube.com/feed...

Does such a JSON string builder exist?

I'm looking to do something like the following in Java and was wondering whether such a JSON library/helper already existed out there somewhere? SomeJsonBuilder builder = new SomeJsonBuilder(); builder.add("one", "oneValue"); builder.add("two.three", "threeValue"); String output = builder.toString(); Such that the output string above ...

Parsing Json to display polyline/markers with google maps v3

I'm using Jquery getJson() to generate a json to be displayed on the google maps 3 api. I would like to display the poly line as per the : polyline-simple example function initialize() { var myLatLng = new google.maps.LatLng(0, -180); var myOptions = { zoom: 3, center: myLatLng, mapTypeId: google.maps.MapType...

Creating a "two way" configuration file

Hello everybody, I am writing a PHP application targeted at non-geeks, non-programmers. I need to create an option page with a bunch of "options" and then store those options...somewhere. Using a database application (MySQL/PostgreSQL/SQLite) is out of the question because it will require more configuration than the user needs to do (I ...

jQuery: JSON getting converted from an object to a string?

I'm using the Ajax Form jQuery plugin to get JSON from a server: /** * Helper function for the jQuery AJAX form plugin. */ function bindOnSuccess(form, callback) { form.ajaxForm({ dataType: 'json', success: function (response, status, xhr, $form) { callback(response); } }); } Usage: bindO...

Ruby and MongoDB: Traversing arbitrary BSON document retrieved from mongomapper

In Ruby, how can I traverse an arbitrary document retrieved from a collection using something like mongomapper? Let's say the document looks something like this: mydocs = [{"title":"my title", "description":"hello world", "comments":[{"user":"me","text":"this"},{"user":"him","text":"that"}] }, {.....} ] ...

Rendering Nested JSON String in Listgrid in smartGWT

Hi all, I have a clarification in loading JSON String into Listgrid in GWT. I have implemented GWT-RPC, so from server side JSON string will be returned and have mapped it to grid fields properly. My JSON String looks like return "[ { user: { User ID: 1, name: abc}, initial:A, }, { user: { Use...

Image from json url into a list view

Hi, I have got a tutorial to add custom objects into a list view from here... Now i wanted to know how to display an image along with text in the same process... ...

JQuery returns JSON object with 404

Hi, I'm quite new to the whole jQuery/JSON thing but thought I would give it a go. The idea is that I am posting data to a PHP script and then returning a JSON object. This works fine on my localhost but on the web server, Firebug shows that the JSON object is being returned but I also get a 404 error. Any ideas where I could be going ...

Pros and cons for different configuration formats?

I've seen people using *.cfg (Python Buildout), *.xml (Gnome), *.json (Chrome extension), *.yaml (Google App Engine), *.ini and even *.py for app configuration files (like Django). My question is: why there are so many different configuration file formats? I can see an advantage from a xml vs json approach (much less verbose) or a Pytho...

[C#] How to extract information from an Object produced by JavaScriptSerializer

Hi all! I'm developing an application in C# which can control a SqueezeboxServer(SBS). Communicating to the SBS is via JSON messages to http://serverIP:9000/jsonrpc.js So I send JSON messages via a HTTPWepRequest and get answers via an HTTPWebResponse. The answer I get is a String in JSON notation. And this is where the problems start....

"A JSONArray text must start with '[' at character 1 of null"

Hi Guys, Just wondering what that error could mean? I get it from the following code.. try{ JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("log_tag","id: "+json_data.getInt("id")+ ", name: "+json_dat...

Using the ASP.NET Repeater Control with List<T> object data

I have an ASP.NET web app that places several string data into an object as properties. The string data is sourced from a JSON feed from Twitter. A collection of my TwitterMessages is held in a Generic List. What I want to do is use an asp:repeater to iterate through my List<T> to display all of the contents of the objects it holds, by...

issue to send text using jquery's $.ajax() and ASP.Net

Hello everybody, i use to work with the animation on jquery but never ajax, so it's my first experience with $.ajax() function of jquery: i am trying to make my web application only using jquert library, i checked over the web for a good tutorial to make asp.net and jquery work, and i found an walkthrought, in this article they send a i...

jQuery, MVC, jSon - constructing table of divs, filled by call-backs

Hi all, I'm trying to construct a table with dynamically build information. My thought was to put DivA inside each of the cells, and then put DivB and DivC inside the DivA-tags (DivB showing a 'loading' img and DivC showing the contents). I would then like the cells to be updated using json calls to my ASP.Net MVC web application. Does...