json

How can I display HashMap constructed by JSON?

I know I can display an ArrayList by using for(i=0;i<data.list.length;i++){ html += data.list[i] +"<br />"; } to display the AarryList Object, I tried the same with HashMap object but it simply doesn't work. Thanks in advance. ...

Delicious API - All bookmarks for a given website?

Is there a way for me to get at a list of the URLs on my website which people have bookmarked on the delicious.com website? Their documentation appears to make no reference to wildcard searches or anything other than individual URLs. Any suggestions? ...

jquery to convert strings to json to send to my webservice?

Hi there, Trying to figure out how to convert how to covert 5 variables i have in javascript (strings) to a json for sending along to my ajax function here is my ajax funtion, sill relatively new to this but i believe this should work .. but i need to convert all my strings to a json - don't i? I believe there are alternative ways of ...

Passing js object as json to jquery?

I have the following but it's not working, I read somewhere on the stackoverflow that it works like this but I can't seem to get it to work.. it errors... am I doing something wrong? If I do pass data like this - it works -- so I know my service is working //THIS WORKS data: "{one : 'test',two: 'test2' }" // BUT SETTING UP OBJECT do...

recommended return type for a webservice that doesn't return anything (called with jquery)

Hi there, I have a web service with some methods, they technically don't do much on the client.. i am calling it by jquery/ajax What is the recommended return type, i would normally return JSON ... but in the case that it doens't return anything .. do i return a boolean? i.e. true = succesful ... and false = error ?? Any ideas? ...

When to use Ajax vs Json for Javascript events?

I'm not so familiar with Ajax but I keep hearing Json mentioned as some kind of competing option. Is there a rule for when to use one versus the other? I'd like to process Javascript events in my app and update the front-end dynamically from the app but I'm not sure whether I need to use Ajax or Json for this. ...

How to post JSON data to a server using Java

Hi, I am trying to build a POST request to send JSON data to a server using a REST api. As the JSON code will be embedded in the request body as a request parameter value, do I need to encode the value to escape special characters like '{}[]' you typically find in JSON syntax. Is there any utility library to do that ? N. ...

Does Rails' Ajax support make JSON or XML an easier format to work with?

Being new to Ajax, I would like to understand which data exchange format - JSON or XML - would be easier to work with while doing Ajax in Rails. Do the various Rails helpers make one or the other format easier to deal with or does it depend on the context or does it not matter at all? ...

How to search List<> with Json Generic deserialized object

I need to filter a generic List with data from a Json object. I have the deserialized object in a list with {name:'', value:''}. I need to search a data contract (which is also a list) with name as the field to search, and value as the value of the field. How do I accomplish these as they are generic. Here is the method: public List...

Is a simple id->json in SQLite store reasonable for a cheap and dirty Q&A storage?

The Situation I have a very compressed time schedule to write a simple (basically write-only web app). The app is to be a mostly jQuery-driven question tree. The questions and tree will probably need to change both before and after the site launches. The answers will get emailed... I probably don't even need to store them, but I'm g...

encode JSON in FBJS

Hi, I'm trying to encode a JS object into a JSON string (to read into a SWF as a FlashVar) but the encoders all seem to error out due to facebook prefixing the names of all JS objects with the app ID. I am not a very good JS debugger but the errors are telling me objects are not defined. ...

how to create a JSON object in action class of JAVA

I want to create a JSON object. I have tried the following myString=new JSONObject().put("JSON", sampleClass).toString(); but mystring gives me {"SampleClass@170f98"}. I also tried the following XStream xsStream=new XStream(new JsonHierarchicalStreamDriver()); SampleClass sampleClass=new SampleClass(userset.getId(),userset.getUser...

ExtJS grab JSON result

Hello. I'm generating JSON response from PHP witch looks like this: { done:'1', options: [{ message:'Example message'},{message:'This is the 2nd example message'}]} I want to grab these results using ExtJS. This is what I have so far: Ext.Ajax.request({ loadMask: true, url: 'myfile.php', params: {id: "1"} }); What d...

Is this valid JSON?

{"something":"1","mode":"true","number":"1234"} Because I'm getting a 406 on expecting JSON. It's being generated via Jersey, which is told that a method @Produces JSON. It's being received by a Dojo xhrGet which has JSON set as its handleAs. EDIT - To clarify, I'm not interested in the code where I evaluate or anything like that. Th...

Alternatives to JavaScript eval() for parsing JSON

Quick Question. Eval in JavaScript is unsafe is it not? I have a JSON object as a string and I need to turn it into an actual object so I can obtain the data: function PopulateSeriesFields(result) { data = eval('(' + result + ')'); var myFakeExample = data.exampleType } If it helps I am using the $.ajax method from jQuery. T...

JavaScript libraries / toolkits that support binding JSON data to HTML controls?

Are there any JavaScript libraries or Toolkits that allow me to bind the JSON data to html controls on the client? So essentially I should be able specify the object property to which a html control should be bound. Hence when the form receives the JSON data, the controls are updated, and when the controls are updated, the data should b...

C# automatic property deserialization of JSON

I need to deserialize some JavaScript object represented in JSON to an appropriate C# class. Given the nice features of automatic properties, I would prefer having them in these classes as opposed to just having fields. Unfortunately, the .NET serialization engine (at least, by default) totally ignores automatic properties on deserializa...

Collecting every word in document DOM tree with javascript

Suppose you have a large document with around ~7000 words. I need to send all data to server. I have no chance to use jquery, prototype etc. It should be clean OO javascript. Sample page would be json russian page I will exclude all tags and html markup from words. My question is; 1. How can i collect/harvest all (utf8) words from do...

Representing Partial Dates in a JSON API

I am managing a RESTful JSON data API, which is growing in scope. Currently, we are returning all dates over the wire as strings "YYYY-MM-DD", but we also need to represent the concept of partial dates. What I mean by a partial date is a date value that has unknown components, either a Year-Month, or just a Year. In our presentation lay...

JSON Spec - does the key have to be surrounded with quotes?

Example: Is the following code valid against the JSON Spec? { precision: "zip" } Or should I always use the following syntax? (And if so, why?) { "precision": "zip" } I haven't really found something about this in the JSON specifications. Although they use quotes around their keys in their examples. (So I'll do that too f...