json

Need a simple example of a web service call Returning a List of object and how to parse them out in javascript

I have a simple web service with a web method that creates a list of objects.. public string GetPersonList() { Person p1 = new Person { Name = "Rich", Age = "33" }; Person p2 = new Person { Name = "Rebekah", Age = "34" }; Person p3 = new Person { Name = "John", Age = "20" }; List<Person> p = new List<Person>...

How does ASP.NET MVC Generate JsonResults?

I want to inject some Json into the Html page returned by the server? Is there a public function that returns the Json string when Json(someObject) gets called? Note that I don't want to return Json to the browser in a seperate request. I want to convert an object graph to json and inject it into a script block. Thanks ...

Is MVVM possible/viable in a DHTML RIA application (no Silverlight/WPF)?

Note: This is a long winded question and requires a good understanding of the MVVM "design pattern", JSON and jQuery.... So I have a theory/claim that MVVM in DHTML is possible and viable and want to know if you agree/disagree with me and why. Implementing MVVM in DHTML revolves around using ajax calls to a server entity that returns J...

how do I access a bit of the JSON with jQuery?

Hi everybody, I think this is a simple issue I just haven't worked with JSON like this before. Very simply, I have a JSON object: fc_json = { "product_count": 1, "total_price": 199.95, "total_weight": 1, "session_id": "26e8og4ldmlunj84uqf04l8l25", "custom_fields":{ "affiliateID":"25" }, "messages":{ "errors":[], ...

Serializing Array of Objects to JSON in WCF to Comply with OpenSearch

I'm trying to write an OpenSearch Suggestion service that complies with the OpenSearch spec. http://www.opensearch.org/Specifications/OpenSearch/Extensions/Suggestions This spec requires the service to return a JSON array with the first element being a string and the following elements being arrays of strings. I'm able to get it almo...

how do I use the json google translate api?

I am trying to use google translate from python with utf-8 text. How do I call the json api? They have a document for embedding it in html but I can't find a proper API or wsdl anywhere. Thanks Raphael ...

json data not responding to alert

$(document).ready(function() { $('form#search').bind("submit", function(e){ e.preventDefault(); $('#content').html(''); var query1 = urlencode($('input[name="user_a"]').val()); //userA $.getJSON('http://twitterank.com/...

JSONQuery parser in Java

Hi everyone, does someone know a JSONQuery parser in Java? Thanks a lot in advance! -- Andreas ...

Encoding JSON for jQuery Calendar

Hi, I'm trying to use the PHP json_encode function to encode some JSON to send along to a jQuery plugin that will render out a calendar. The plugin's name is FullCalendar. I've started on grabbing event data from a MySQL database and encoding it in a JSON string, but I've run into a problem. The default JSON example that comes with the...

Returning JSON AND XML format from a .NET 3.5 WCF web service (REST)

I have an existing web service that returns XML responses and I would like to add some new methods that return JSON. Do I have to create a separate web service that returns in JSON or can I have a mix? If I use the ResponseFormat = WebMessageFormat.JSON I need to have the service annotated with [DataContractFormat] but I cant seem to ha...

access tr and its content in a table with jquery

I am doing an MVC with C# application. I was trying to access the entire row in a table and change the values in each cell using jquery. I need to do change the value in each td once a json call is succeeded. Please advice for this ...

Is there any advantage of AJAX/XHR over pure JSON/P implementations?

Not strictly a programming topic but input is appreciated. I've been developing a lot lately with YouTube APIs and I started with PHP code, using SimpleXML, then actually skipped AJAX and went straight to using native JSON and doing everything client-side. While it "feels" faster, I wonder if it's ready for primetime yet. Even with t...

Convert Html to Django Fixture (JSON)

We've got a couple of Django flatpages in our project, that are based on actual HTML files. These files undergo some changes once in a while and hence have to updated in the database. So i came up with the idea of simply copying the plain HTML text into a json fixture and do an manage.py loaddata . However the problem is, that there are ...

JSON Data - Parsed Or 'Eval'ed

From a security perspective, I can see simply doing an 'eval' on incoming JSON data as a critical mistake. If you got data like below you'd have some problems. { someData:((function() { alert("i'm in ur code hackin' ur page"); })()) } I wondered what do most popular Javascript libraries do? Is it a manual parse or simply an eval...

Read page content, convert to json, enter to SQL?

I want to read the content from an external page, convert that into a predefined format, and then enter it into a database. This is just for fun--it's taking an event list and copying the events to my own site. Take this page, and manipulate it to fit a different format... Is it possible to do this with jquery? ...

Javascript: Difference between an object, and a hash?

In Javascript, what is the difference between an object and a hash? How do you create one vs the other, and why would you care? Is there a difference between the following code examples? var kid = { name: "juni", age: 1 } And: var kid = new Object(); kid.name = "juni"; kid.age = 1; And: var kid = new Object(); kid["name"] = "jun...

Hacking JavaScript Array Into JSON With Python

I am fetching a .js file from a remote site that contains data I want to process as JSON using the simplejson library on my Google App Engine site. The .js file looks like this: var txns = [ { apples: '100', oranges: '20', type: 'SELL'}, { apples: '200', oranges: '10', type: 'BUY'}] I have no control over the format of this ...

YQL XML Output with custom namespace

I am attempting to parse a JSON feed from Yahoo Pipes to turn it into XML, using YQL. My query is: "select * from json where url='http://pipes.yahoo.com/pipes/pipe.run?_id=[pipe-id]&amp;_render=json'" The problem is that the original Pipe was parsing an RSS feed, filled with dublin core tags (example: dc:title, dc:source, etc). The XML...

.NET - JSON Data - Deserialization - Lists & Dictionaries

I need to pull back from a database JSON documents that are not based on a standard object. Is there a way using .NET to "deserialize" these documents into Lists & Dictionaries of primitive objects (string, int, bool, etc...) Any library that can do this in both directions? ...

How do I marshal nested lists as JSON using Jersey? I get an array of nulls or an array of one-element dictionaries containing an array.

I'm working on a project which uses Jersey to convert objects to JSON. I'd like to be able to write out nested lists, like so: {"data":[["one", "two", "three"], ["a", "b", "c"]]} The object I'd like to convert first represented data as a <LinkedList<LinkedList<String>>>, and I figured Jersey would just do the right thing. The above wa...