json

A UnicodeDecodeError that occurs with json in python on Windows, but not Mac.

On windows, I have the following problem: >>> string = "Don´t Forget To Breathe" >>> import json,os,codecs >>> f = codecs.open("C:\\temp.txt","w","UTF-8") >>> json.dump(string,f) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python26\lib\json\__init__.py", line 180, in dump for chunk in iterable...

rails dates with json

hello am implementing a facebook application and am using AJAX/Json,however the json structures that are returned have this format "2010-05-30T06:14:00Z" , I am using Game.all.to_json how can i convert them to a normal date format ? Is it easier to do it from the server side or the client side using fbjs? (there are a lot of bugs with ...

Problem in loading cities using JSON

I am using Geonames for loading the cities using JSON. Geonames data i imported into my database. I am using MS SQL 2008 Server. I display a dropdown for country select. Once the user select the country. I am loading all the cities into the autocomplete textbox. I am facing a delay in the getJSON method. Also it seems like executing asyn...

Python how to handle # in a dictionary

I've got some json from last.fm's api which I've serialised into a dictionary using simplejson. A quick example of the basic structure is below. { "artist": "similar": { "artist": { "name": "Blah", "image": [{"#text":"URLHERE","size": "small"},{"#text":"URLHERE","size":"medium"},{"#text":"URLHERE","...

sending full form data to back end using jquery

i have a form that is dynamically built. so the number of form elements arr not fixed. I wnat to send whole of $_POSt data from the form using jquery to back end for processing .i cant use jquery form plugin as the jquery version i am using is old. any other way ? i tied to do like this $.post('all_include_files/update_save.php',{vari...

Add wordwrap to decoded json text

Hi, I am using a simple script on my PHP webpage to decode and output JSON as text. However, what ever I try I can't get it to wordwrap the output. $file = file_get_contents('sample.txt'); $out = (json_decode($file)); echo $out->mainText; How can I get this script to wordwrap at 600 characters without chopping words in half? If possi...

Convert data retrieved from MySQL database into JSON object using Python/Django

I have a MySQL database called People which contains the following schema <id,name,foodchoice1,foodchoice2>. The database contains a list of people and the two choices of food they wish to have at a party (for example). I want to create some kind of Python web-service that will output a JSON object. An example of output should be like:...

In Ruby, MongoDB returns a BSON::OrderedHash. How to I covert it to JSON? Using to_json give a "stack level too deep" error.

I am trying to make a web service using Ruby Sinatra and MongoDB. It will return JSON objects. I decided to use MongoDB, in part, because it stores documents internally in a "JSON-like" structure. I thought this would make it easy to me to run a query and send a JSON result to the client. However, I have run into problems converting the ...

How to handle this string in json?

I am storing a multiline textbox value in my db table... When i converted this value to json it gives me an error Error: unterminated string literal... My sample data was , I am fetching the row to my datatable and then converting it to json, public string GetJSONString(DataTable table) { StringBuilder headStrBuilder = ...

How to read and parse (local) XML-file in Prototype JS?

I have to create a module in a specific project, which already uses PrototypeJS. What I have: - An XML File with information What I want: - A simple div, which displays the (with XPath filterd) Content of the XML-File. I am complete new to PrototypeJS and dont know where to begin, so I appreciate your help. Blessing chris ...

How to access key itself using javascript

I have a JSON like: var xx = {'name':'alx','age':12}; Now I can read the value of name which is 'alx' as xx[0].name, but how should I retrieve value of 'name' itself? By that, I mean how can I fetch the key at run time? ...

JSONP Implications with true REST

From my understanding JSONP can only be achieved using the GET verb. Assuming this is true which I think it is, then this rules out core compliance with true REST in which you should make use of different verbs i.e. GET,PUT,POST,DELETE etc... for different and specific purposes. My question is what type of barriers am I likely to come ...

Json, Timer, Ajax, What is faster (for shared Chronometer) ?

Hi everybody, I'm developing an application using ASP.Net. For first the idea: "My WebApp needs an chronometerto be shared by users and all users will se the same value in cronometer. When a user clicks on a button, the cronometer needs to be restarted and all users will need to see that!" All right, now I'd like to know what's the ...

jquery-ui autocomplete with ASP MVC suggestions not displaying

I have been trying to get a simple example of the jquery-ui autocomplete to work. I have a controller setup to handle the query, and it returns the json that looks to be in order, but I am getting no suggestions showing up. Here are the js libraries I am including: <script type="text/javascript" language="javascript" src="/Script...

asp.net mvc json 2 times post to the controller

function onTestComplete(content) { var url = '<%= Url.Action("JsonTest","Organization") %>'; $.post(url, null, function(data) { alert(data["name"]); alert(data["ee"]); }); } <% using (Ajax.BeginForm("JsonTest", new AjaxOptions() { HttpMethod = "POST", OnComplete = "onTestComplete"...

confused about how to use JSON in C#

The answer to just about every single question about using C# with json seems to be "use JSON.NET" but that's not the answer I'm looking for. the reason I say that is, from everything I've been able to read in the documentation, JSON.NET is basically just a better performing version of the DataContractSerializer built into the .net fram...

WCF - Increase ReaderQuoatas on REST service

I have a WCF REST Service which accepts a JSON string One of the parameters is a large string of numbers This causes the following error - which is visible by tracing and using SVC Trace Viewer There was an error deserializing the object of type CarConfiguration. The maximum string content length quota (8192) has been exceeded while r...

Deserialize JSON Objects in Asp.Net MVC Controller

Hey guys I'm trying to deserialize an object which was generated by LinqToSql. The user is allowed to edit the data of the object in the view and then it gets posted back to the controller. The edited Data comes in JSON. How does this action have to look like? Something like... public ActionResult(JsonObject json) { MyClass c = Js...

Removing quotation marks in JSONObject

I'm using the net.sf.json.JSONObject to create some data to be sent to a front end application, and the code I'm interacting with doesn't like the ways its adding quotation marks to every field name. For example: myString = new JSONObject().put("JSON", "Hello, World!").toString(); produces the string {"JSON": "Hello, World"}. Wh...

JSON and Iphone table loading, I'm getting a EXC_BAD_ACCESS error when scrolling

Hello, I'm having a bear of a time trying to figure out why I'm getting a EXC_BAD ACCESS error. The console is giving me this eror: " -[CFArray objectAtIndex:]: message sent to deallocated instance 0x3b14110", I Can't figure it out...Thanks in advance. // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableVie...