json

Json data has {d:"data"}

I am writing jquery ajax code to call wcf service. In this case WCf returns html as string. Some how when data is back in jquery it is in {d:"data"} format, What is this d element? below is code $.get('<%= ResolveClientUrl("~/AjaxServices/ListingBrowse.svc/GetNewsHTML") %> ', null, function(data) { a...

Problems using $.getJSON

I'm calling the following URL using YQL http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22UTG.L%22)%0A%09%09&amp;format=json&amp;env=http%3A%2F%2Fdatatables.org%2Falltables.env&amp;callback=cbfunc this returns the following in JSON cbfunc({"query":{"count":"1","created":"2...

jQuery object undefined

Apologies for asking what's probably a very obvious question, I've been banging my head against this all day + I'm very new to JQuery and JavaScript in general. I'm running the following:- <script type="text/javascript"> $(function() { $.getJSON( "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%2...

C# Adding callback to JsonResult

My mvc page returns json by using the function Json(mycustomclass) to return a JsonResult object. This works just fine except, I need to wrap the json in a callback so that jQuery can use it. I want it like this: jsonp1246168411282({"myjson":"some values"}) but I am getting this: {"myjson":"some values"} Is there any way I can 'wrap'...

Alternative to innerHTML

I kind of feel like I'm abusing the DOM with my code... for(var i=0; i<json.length; ++i){ var newobj = document.createElement("div"); var inner = "<img src='"+json[i].picture+"' alt='Item preview' class='icon' />"; inner += "<p>"+json[i].id+"<br />qty:"+json[i].qty; inner += "<a href=\"javascript:clearProduct('"+jso...

JSON serialization in Spidermonkey

I'm using python-spidermonkey to run JavaScript code. In order to pass objects (instead of just strings) to Python, I'm thinking of returning a JSON string. This seems like a common issue, so I wonder whether there are any facilities for this built into either Spidermonkey or python-spidermonkey. (I do know about uneval but that is not...

How to create JSON string in C#

I just used the XmlWriter to create some XML to send back in an HTTP response. How would you create a JSON string. I assume you would just use a stringbuilder to build the JSON string and them format your response as JSON? ...

Serialize to JSON in .NET 2.0

how can you serialize an object to JSON in .NET 2.0 using C#? ...

How to read JSON from Ruby on Rails with ExtJS

I have some existing projects that were built upon a deprecated PHP framework, and I'm hoping to move them over to Ruby on Rails with minimal effort. My main problem right now is the format that the JSON is coming back in. My frontend code (all ExtJS) is expecting JSON in the format: { "result": [ [id: 1, name: "mike"], ...

Ajax in javascript not working.

$(document).ready(function() { $('#content').html(''); $.ajax({ url:'data.json', dataType: "json", success: function(data) { $('#content').append('<p>'+data.rank+'</p>'); } });}); In this code (it works) data.json contains the JSON data in this format: { "user_id":"3190399", "user_name"...

Getting invalid string [ ] around my JSON outputted from using the JavascriptSerializer class

Currently I'm using the helper methods outlined here to return some JSON from my .ashx: http://weblogs.asp.net/scottgu/archive/2007/10/01/tip-trick-building-a-tojson-extension-method-using-net-3-5.aspx Problem is, I get [ and ] wrapped around my JSON which is malformed...jQuery cannot pick it up in the callback: [{"ImageTag":"&lt;img s...

jqGrid - How does one configure jsonreader (for use with Jayrock)?

Hi, I wondered if someone might have some insight into this. jqGrid is quite happy with this JSON string: {'page':'1','total':1,'records':'4','rows':[{'id':1,'title':'Story Manager','assigned':'2009-06-22T10:52:28.0687738-05:00','due':'2009-07-29T10:52:28.0687738-05:00','completed':'2009-07-14T10:52:28.0687738-05:00'},{'id':2,'title':'...

Consuming JSON-RPC web services in .NET

A business partner has suggested building a web services library with JSON-RPC rather that SOAP. (note they are not building in .NET necessarily, but I am) I am a potential consumer of this data. I've used JSON for client-based Ajax calls in the past, but this web services library will be used primarily for server-side calls and syncin...

Quick way to covert a large JSON file to XML

Does anyone know of an application that can be used to convert a large JSON file to XML? We have a program that takes XML input, and we need to feed it some data that has arrived as a JSON file. Rather than update the whole program to take JSON input, it seems simpler to just convert this file. The JSON file is between 3 and 4 GB (and ...

Is there an alternative way of serializing javascript objects to a json string?

I downloaded the code from json.org to serialize/deserialize javascript objects to/from json and it worked just fine. However, in production, it conflicts with my other javascript code apparently because it uses for in loops. Is there another library that does this? Thanks! ...

Is there a tool to generate C# classes based off a JSON string?

I'm wondering if there is a tool out there that can take in a JSON string, analyze it, and generate a C# class file that can then be used to deserialize the json string into a C# object of that class. I'm looking for something similar to a code generator of sorts, but the input would be a JSON string, instead of a database table/view/wh...

json array: How to create new array elements?

My aim is to get a json array like this one: var args = [{ name: 'test', value: 1 }, { key: 'test2', value: 2}]; How can I get the below code to build up an array like the above one? this.dependentProperties = []; //array function addDependentProperty(depName, depValue) { dependentProperties.push(new Array(depName, depValue))...

Calling jQuery Function with Javascript Function

Having some trouble getting this to work, specifically with $.getJSON(). I want to wrap the getJSON function from jQuery in a Javascript function like so: function reload_data() { $.getJSON("data/source", function(data) { $.d = data; }); } But when I call reload_data() it doesn't execute the jQuery function inside. Any...

Parsing JSON in Erlang

I have a piece of JSON string, which I want to parse in Erlang. It looks like: ({ id1 : ["str1", "str2", "str3"], id2 : ["str4", "str5"]}) I looked at mochijson2, and a couple of other JSON parsers, but I really could not figure out how to do it. Any help greatly appreciated! ...

How to reuse Jersey's JSON/JAXB for serialization?

I have a JAX-RS REST service implemented using Jersey. One of the cool features of JAX-RS/Jersey is how easily a POJO can be turned into a REST service, simply by sprinkling a few Java annotations... including a trivially easy mechanism for translating POJOs to JSON - using JAXB annotations. Now, I'd like to be able to take advantage of...