json

Validating input with jQuery autocomplete plugin

I'm using the standard autocomplete plugin here. I have two text boxes on my form, item name and item id. The idea is that I want the user to search for the item by name, but on form submit I actually need the item id. I am returning json from an ASP.NET MVC action which is used in the autocomplete. The user starts typing an item name...

Converting Strings to booleans when converting XML to JSON

This block of code essentially takes a JAXB Object and turns it into a JSONObject StringWriter stringWriter = new StringWriter(); marshaller.marshal(jaxbObj, stringWriter); try { JSONObject jsonObject = XML.toJSONObject(stringWriter.toString()); resp.getOutputStream().write(jsonObject.toString(2).getBytes()); } catch (J...

Iterate through javascript object with generated variable names

Hi, I'm trying to iterate through a bunch of variables in a javascript (using jQuery) object that was returned through JSON, without having to specify each variable name. What I want to do is loop through the following elements of an object and test their values: obj.pract_0 obj.pract_1 obj.pract_2 obj.pract_3 .. .. obj.pract_100 The ...

$.getJson() Problem and returning an undefined value

I have a php script which produces the JSON object. In my jquery I am using this code to call the php script. $.getJSON("/st/std.php", function(data){ alert(data); $("myspan").text(data); } ); How Do i get the Data from THE JSON Encoded in php File .In the form Iam entering some code which will perform the ajax ...

Ajax query to my webservices is returning xml in my json

Hi I am having this exact problem as raised in this question http://stackoverflow.com/questions/1121559/asp-net-json-web-service-always-return-the-json-response-wrapped-in-xml It's late and I have been sitting in this chair for 10 hours now trying to get ajax and json to work and all I got was deeply frustrated. So does anyone know ...

jquery autocomplete using json

I have tried so many things but I don't understand this sooo confusing. I have this <input id="wba" type="search" name="q" value="" class="search box" /> <input type="submit" value="Go" class="search button" /> also a php file header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); $arr = ar...

How do I create json file from plist file?

I want to create a json file from from exsited plist file. How do I create json file from plist file using programg language (Javascript or Java or Objectiv-c or Python or Ruby)? ...

Is there any way to add method to JSON object?

Is there any way to add method to JSON object? ...

How to wrap return type of ajax call in success with function

I have a Web Service and it always brings back one object from my class that i defined on the server side. in success method of $.ajax function i always get the this object. And on the client side i want to add couple of functions to display its properties quickier. Is there a way do that ? (JSON object will return, i am worrying about...

Why the open quote and bracket for eval('(' + jsonString+ ')') when parsing json string

Can you please tell me the reason for this specific syntax structure eval('(' + jsonString+ ')') When parsing json text. Crockford says "The text must be wrapped in parens to avoid tripping on an ambiguity in JavaScript's syntax." here. What does that mean? Can we avoid it? ...

Associating a variable with a class in C# (for JSON)

I'm having to grab API-provided JSON for a project of mine, and that means deserialising JSON using a class, and I've chosen to go with DataContract classes. In any case, different URLs correspond to different JSON outputs for the API. So what am I asking? It's to see if there's any better way to have URLs corresponding to the DataContr...

Json in Javascript

Hi there, trying to learn json due to work req...i am trying to add and delete records to json object dynamically...can some one tell me why i keep getting UNDEFINED message....here is the code..thanks for the help!! <html> <head> <title>TEST</title> <script language="Javascript" type="text/javascript"> function addC(){ var index =...

JSON PHP Javascript - Simple Working Example

HI, I am using the following code request.js var request; function runAjax(JSONstring) { // function returns "AJAX" object, depending on web browser // this is not native JS function! request = new XMLHttpRequest(); request.open("GET", "request.php?json="+JSONstring, true); request.onreadystatechange = sendData; ...

accessing json data

hi there, I am using this array( as an example) http://pastebin.com/M0ZJgAVs i am using json_encode() on it and fetching it using javascript does anyone care to tell me to get the num rows would i simply use var numrows = json['numrows']; and to loop over each row would i use for(row in json['rows']) { } and then inside tha...

json: references

Hi, I'm using JSON with Gson package for java. I have an object where there are some inner references from object in one field to object in another field. For example: { "loci": [ { "id": "loc1", "length": 10000, "start": 2 }, { "id": "loc2", "length": 100, "start": 50000 } ], "scenarios": [ { "id": "s...

Formatting a JavaScript date into a string for JSON DeSeriailization.

Hi, I am using the .NET NewtonSoft JSON serialization library and it is expecting date fields in this format: "UpdateTimestamp":"\/Date(1280408171537+0100)\/" Does anyone know how I can format javascript date object into this format? Thanks Paul ...

passing a data structure from java to perl (and vice versa)

Hi, A few days ago I asked about passing a data structure from java to perl and vice versa, and one of the recos was JSON. I played with it (mainly using Gson for java) and it seems quite nice. The only problem is I have references inside my data structure (to other objects inside the same data structure). Currently, each such reference...

Ajax query to my webservices is returning xml in my json - Part 2

Hi It's me again (previous question) I am still having problems with json and xml being returned from an ajax call. I have written a webservice in MonoDevelop version 2.2 to return my json. [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string getLocationJ(){} Which returns:- JavaScriptSerializer js = n...

NPE not occuring or being caught in Servlet

I have a pretty basic Servlet public class DreambearLoginServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { JSONObject ret = new JSONObject(); try { // handle the request try { ...

[JQUERY - JSONP] webkit based browser interpretate the json as a script

hi guys! im just tryin to get my zootool items via js to push them in my blog's footer...but with no success. here's the code im using (jquery framework) jQuery(document).ready(function($) { //first try var url = "http://zootool.com/api/users/items/?username=USER_NAME&amp;apikey=API_KEY&amp;jsonpcallback=?" $.getJSON(url, function(data...