json

Data format that looks like JSON, but isn't. Can you help identify it?

I have no friggin' clue what this data format is called. Do you recognize it? http://pastebin.me/ced13687cf12fb85b334a5960a4cf985 It's JSON-esque, but obviously not JSON. We can thank Google for blessing us with this little enigma. ...

when converting a python list to json and back, do you cast?

When you convert a list of user objects into json, and then convert it back to its original state, do you have to cast? Are there any security issues of taking a javascript json object and converting it into a python list object? ...

How to get data out of JQuery getJSON callback

I need to get the JSON object data out of the callback function so that I can process it later in page, not within the callback as I am now. It must be obvious to everyone else as I can't see anything written about it. Can anyone tell me how to do it? Here is my code: <script type="text/javascript" src="/site_media/js/jstree/_lib/jquer...

PHP/JSON/jQuery - JSON response from PHP script being enclosed in <head></head><body> ... <body>

I am trying to debug a simple PHP/JSON/jQuery problem. the following PHP script: header('Content-type: text/javascript'); echo json_encode(array('type'=>'error','message'=>'arg')); is being consumed by jQuery but when the line: var results = jQuery.parseJSON(responseText); is executed, the jQuery JSON parser gives the following: ...

Cannot deserialize JSON array into type foo

I am trying to parse out data from oodle.com api feed using the JSON.NET lib. Part of the response JSON string to deserialize has the following 'location' structure: "location":{ "address":"123 foo Street", "zip":"94102", "citycode":"usa:ca:sanfrancisco:downtown", "name":"San Francisco (Downtown)", "state":"CA", "country":"USA", "latitu...

I have a json object now how do I make a div with the elements

I am using getJson to pull in some info onto the page $('#request_song').autocomplete({ serviceUrl: '<%= ajax_path("trackName") %>', minChars:1, width: 300, delimiter: /(,|;)\s*/, deferRequestBy: 0, //miliseconds params: { artists: 'Yes' }, onSelect: function(value, data){ // alert('You selected: ' + value + ', ' + $('#...

J2ME, how to encode and decode Json?

how to encode and decode Json in J2ME? ...

Django/python is converting my post data from JavaScript

When I post a JSON string to Django by Ajax, it converts it into an invalid JSON format. Specifically, if I look in the post data in Firebug I am sending: info {'mid':1,'sid':27,'name':'aa','desc':'Enter info' } Yet when I access it in the django request I am seeing: u'{\'mid\':1,\'sid\':27,\'name\':\'aa\',\'desc\':\'Enter Info\'}...

Values in UTF-8 being encoded as NULL in JSON

I have a set of keywords that are passed through via JSON from a DB (encoded UTF-8), some of which may have special characters like é, è, ç, etc. This is used as part of an auto-completer. Example: array('Coffee', 'Cappuccino', 'Café'); I should add that the array as it comes from the DB would be: array('Coffee', 'Cappuccino', 'CafÃ...

Parsing an array encoded in JSON through perl

Following perl code I have written to parse an array in JSON. But the array returned has length 1 and I am not able to iterate over it properly. So the problem is I am not able to use the array returned. #!/usr/bin/perl use strict; my $json_text = '[ {"name" : "abc", "text" : "text1"}, {"name" : "xyz", "text" : "text2"} ]'; use JSON; ...

Get property of object in JavaScript

Basically I have a form with a <select> that chooses which set of data to use (values are "m", "f" and "c"). I then have a dictionary/object with the data in: var gdas = { // Male "m": { "calories": 2500, "protein": 55, "carbohydrates": 300, "sugars": 120, "fat": 95, "saturates": 3...

Android connecting - WCF Service should return JSON

Iam connecting my Android app to a wcf service, and in my Log.i I can see that it return data correct, The only thing I want to handle it as JSON but my service sends as XML-(I think): this is how the code in the app looks like: if (entity != null) { InputStream instream = entity.getContent(); BufferedReader reader = new Buff...

How to find properties path in JSON?

I noticed that JSON files don't have null values for certain properties, because they don't list the property at all... this, compared to XML, creates me lot of problems ... I wonder if there is any function to find a property inside JSON... I imagine something in jQuery like $(data).find("myPropertyIneed").val(); instead of data.Ma...

How to parse information in PHP?

I have the following text below, what is the easiest way to parse through it? if(typeof sa_inst.apiCB == 'function') sa_inst.apiCB({"AS":{"Query":"g","FullResults":1,"Results":[{"Type":"AS","Suggests":[{"Txt":"g<strong>oogle</strong>","Type":"AS","Sk":""},{"Txt":"g<strong>mail</strong>","Type":"AS","Sk":"AS1"},{"Txt":"g<strong>oogle</st...

Unknown host exception in HTTP request json-android

I really dont know why is this android code not working.. It shows unknown host exception: String requestTpServer = "www.google.com"; HttpClient client = new DefaultHttpClient(); HttpResponse response = null ; try { HttpGet get = new HttpGet(requestToServer); get.setHeader("Accept", "application/json"); get.setHeader("content-...

Sharing data between two classes

Hi, this is my first iPhone application and I'm using JSON framework to decode JSON sent from a server. I insert the data in a NSMutableArray from an AppDelegate file. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { responseData = [[NSMutableData data] retain]; ...

JSON for Java, Encode a JSON array - Streaming

[I have some code to create a JSON array. In this code I am passing some values to x, y, z in a loop which looks like this. JSONArray list = new JSONArray(); String jsonText = null; for (int j = 0; j < 4; j++) { list.add(new Integer(x)); list.add(new Integer(y)); list.add(new Integer(z)); jsonText = ...

What program can I use to create and edit json files?

I'm using osx and want to create and edit json files. Is there a program that I can use to do this automatically? For example I have an excel file that I want to convert into JSON format. I thought I could read in the file using python and write it out according to the json schema, but I was not sure if there was an easier way to do it....

Fetch first element in 'new array' JSONP response with Jquery

I try to keep it simple: Problem: how to fetch the first element (weight here) from the new Array with JQuery Current JQuery: function xyz() { var the_url = 'http://longurl'+encodeURIComponent(searchBox.val()); var x1 = $.ajax({ type: "GET", url: the_url, ...

Getting followers from Twitter API via json results nothing in jQuery

Hey I'm trying to include list of my followers on my site. Here's my code: $.getJSON('http://twitter.com/statuses/followers.json?screen_name=username',function(data){ alert(data); }); However, nothing happens. No errors, other js still works, just this doesn't work. What is wrong? Martti Laine Ps. I'm using jQuery for this, as ...