json

NoClassDefFoundError when trying to unit test JSON parsing in Android

I'm working on an Android app where some part of it gets JSON-formatted data from a web service. The basics of the class parsing the JSON data looks like this: public class JsonCourseParser implements CourseParser { public Course parseCourse(String courseData) { Course result; try { JSONObject jsonObject = new JSONObject(cour...

How can I deserialize an array inside a JSON object?

I can't work out how to deserialize an array inside a JSON object using Gson. The json object that i'm trying to deserialize looks like this: {"item0":3, "item1":1, "item2":3, "array":[ {"arrayItem1":321779321, "arrayItem2":"asdfafd", "arrayItem3":"asasdfadf"}]} I manage to build a class that looks like this: public...

android webservice to a php server (XML vs JSON and SOAP vs REST)

Hey guys, I am actually looking for some opinion on how to get this done. I have a php server with a mysql backend to authenticate users using android os. I came across the debate of having JSON vs XML to minimize the overhead and using REST vs SOAP. Can I get some tips on what is the best path to go about getting this done ? I know its...

formview with updatepanel vs. jquery/json

Hi, I have a form that's pretty large: about 30 fields, with some very long ones (user's notes for instance) and some can be of variable lenght (a variable-size list of books/title/author). The design calls for the edit view to be in a popup that edits sections of the form at a time. The page must also use ajax so that it never refreshe...

Xml to JSon, Character Problem

hi, in my application I am doing conversion from, xml to Json object with this method; JSONObject result = org.json.XML.toJSONObject(postData); But, I have problems with turkish characters. It is not converting turkish characters from xml to json. How can I do this? Thank you. ...

Syntax for documenting JSON structure

So I'm trying to document the format of the json returned by an api I am writing against and I'd like to know if there is any popular format for the documentation of json structure. Note I'm not trying to to test or validate anything, I'm just using this for documentation. Also some ways to add comments to non-constants(items always re...

Jackson : custom collection serialization to JSON

I am trying to json-serialize a class MyRootClass with a property that is a collection of elements of a second class MyClass: public class MyRootClass { private List<MyInterface> list = new ArrayList<MyInterface>(); // getter / setter } public class MyClass implements MyInterface { private String value = "test"; // gett...

How to create in php a search.json twitter-like

Hi, I've made on my website a search.php file that produce a JSON string, helping me to use real-time ajax for my apps. But now, I'd like to open it as an API to others, but I discovered that $.get $.getJSON $.ajax doesn't allow to use my search.php file from other servers/domains. How can I do to transform my php search into a search...

Calling JSON-enabled WCF service with jQuery returns null

I have the following script in my web page to call out to a JSON-enabled WCF service that I have created and am hosting on my web server. However, the alert displays "null". When I point to the url in a browser it returns very simple JSON: {"city":"Ann Arbor"}. Also, when I run the page containing the code below with Fiddler running,...

Open files from a web application with another web application?

So these days we want things to be on the cloud. In the desktop area we could use one application to create a file, then another to open that file. I wonder how you accomplish this file sharing between web applications? Eg. if I create a web application letting the user create a file, how do I share this file to another web applicatio...

Sending Multiple Dropdown selected values as Hidden Field using JQuery

I want to be able to send all the selected values from a dropdown box (which allows multiple selection) as a hidden field using JQuery. I was able to send/retrieve a single value on form submission. If anyone can share some code snippet, that would help. Thanks in Advance! ...

I want that when the mouse is over one option in my drop-down list, the background color of the option value on my second mask must be changed

Possible Duplicate: I want that when the mouse is over one option in my dropdownlist, the background color of the option value on my second mask must be changed I have 2 dialog mask on my screen On the fist one I have a drop-down list with different option values. On the second I have a div table. I want that when the mous...

jQuery JSON - why am I getting the following error?

When using: - $.getJSON("admin.php?format=json", { module: "data", action: "allBusinessUnitsByClientName", clientname : $('#client').val() }, function(json) { $.each(json.items, function(i,item){ alert(i); }); }); I get the following error in the Firebug console:- a is undefined a))();else c.error("Invalid JSON: "+a)...

Using jQuery to process a JSON object

My JSON object is constructed like this: var Source = { Object: [ //Array {Title: 'Test', Type: 'Pet', Category: 'Cat', Description: 'Fluffy', Count: 2 } ] }; I was able to figure out how to properly add to the 'Object' array, but I can't seem to figure out the jQuery syntax to query the object based on the property li...

How do I translate JSON and XML between each other?

Hey, I have a quiz really soon, and part of it is translating between JSON and XML. How do I do this? ...

How does JSON translation work?

I have this JSON: { animals:{ dog:[ { name:'Rufus', breed:'labrador' }, { name:'Marty', breed:'whippet' } ], cat:{ name:'Matilda' } } } Why is it that it translates to this: <animals> <dog> ...

Accessing data from a json structure

I am loading in a JSON feed from Facebook (snippet below). { "data": [ { "id": "115972604762", "from": { "name": "Title Here", "category": "Musicians", "id": "20274769762" }, "name": "It was an amazing gig!!", "picture": "http://photos-h.ak.fbcdn.n...

How to use JSON2 in Node.js

I want to use json2 as JSON.parse in node.js, (forgive the stupid question) I can't quite figure out how to use it. I have a copy of json2.js, with the first line removed in my current working directory. Then, from the node.js shell i do: > orig_func = JSON.parse [Function: parse] > require('json2') { JSON: {} } > orig_func === JSON.par...

How to return data fetched from MySQL into a php file as JSON?

I have to return data fetched from MySQL table into a php file as JSON. Here is my code to connect to mysql & get data from it. How could now I return it as JSON. <?php $username = "user"; $password = "********"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to...

Problem of serializing javascript object to JSON string.

My question is sort of stupid that why JSON.stringify({"annotation": [{"x":1, "y":2}, {"x":1, "y":2}]}) does not return {"annotation": [{"x": 1, "y": 2}, {"x": 1, "y": 2}]} but returns {"annotation":"[{\"x\": 1, \"y\": 2}, {\"x\": 1, \"y\": 2}]"} and how can I get the first output? ...