i need to return a JSON with this format:
{"answers": [{"id": "93", "value":"Ahstron"},
{"id"="94", "value"="Sampers"}]}
Im using the return Json() method form ASP MVC Framework, is there a way to specify that this JSOn is a collection of answers like in the sample code? or must i create my own?
with the
return Json(a...
$.getJSON('http://twitter.com/followers/ids.json?screen_name=' + query1 + '&callback=?', function (data) {
console.log('JSON data string 1 is: ' + data);
$.getJSON('http://twitter.com/followers/ids.json?screen_name=' + query2 + '&callback=?', function (data1) {
console.log('JSON data string 2 is: ' + data1);
f2 = ...
jQuery v1.2.6
jQuery.autocompleter plugin v1.1pre (from jQuery's website)
I am not able to submit with 'type: "POST"' back to my webservice. I can't get it to be recognized by the autocompleter. Thoughts?
This code below works fine, as long as I look for the "q" querystring. But, I would like to use this for more advanced features ...
Hey everyone,
For the past couple of days, I have been trying to get GWT to interpret either a JSONValue or a string of XML that gets passed back from the server (using PHP).
I'm pretty frustrated, because I can't seem to get anything to work. For the XML, I have confirmed that the String passed from PHP to GWT is a correct XML string...
Is there a way to get the name of the first property of a JSON object?
I'd like to do something like this:
var firstProp = jsonObj[0];
edit: I'm getting a JSON object wich hold categories of arrays with image urls.
like so:
{
"category1":["image/url/1.jpg","image/url/2.jpg"],
"category2":["image/url/3.jpg","image/url/4.jpg"]
}
...
I'm manipulating few data with PHP, I have the choice between Json and XML. But I don't know what to choose, I never worked with one of them. So I want the easiest one.
Also I wonder if there's good classes that can make parsing (XML or Json) easier.
I focus mainly on ease of use rather than speed and scale.
...
Hey everyone,
I have succesfully been able to parse a JSON into a JSONTree, however, my tree shows the iterators. I have tried iterator.remove(), but I get the error:
Error: java.lang.UnsupportedOperationException: Remove not supported on this list
Can someone please look at my code, and let me know of anything I can do? Thanks!
publ...
I found this? Is this the best way to do it?
http://weblogs.asp.net/dwahlin/archive/2009/05/03/using-jquery-with-client-side-data-binding-templates.aspx
I'm looking to use some sort of repeat loop with variables that throw in JSON data.
I am using Codeignitor and jquery.
Thanks
...
I saw a similar question but it did not resolve my issue. I have a JSON web service in an ASMX file;
The code for the web method
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetUserRoles(string JSONUserCode)
{
string retRoles = string.Empty;
List...
I have a string:
"{0:16970861903381446063,length:1}"
I tried converting it to an object using the eval method, but it also evaluates the string and hence rounds the numerical value, returning:
{0:16970861903381447000,length:1}
I tried passing the number as a string before calling eval on it,
using 16970861903381446063 + '' as the ...
I have a complex type:
[DataContract]
public class CustomClass
{
[DataMember]
public string Foo { get; set; }
[DataMember]
public int Bar { get; set; }
}
I then have a WCF RESTful webservice that has this in it:
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMess...
I am trying to make a rest service that receives complex types from a Jquery $.ajax post but I cannot seem to convince mvc to hydrate my complex objects in the controller.
The following is some of my code:
Controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ChargeUser(TransactionInfo transactionInfo, CardInfo cardInfo) {
//...
I am using mochiweb and I don't know how to use its json encoder to deal with complex data structure. What's the differences between mochijson and mochijson2? Is there any good example? I always get the following errors:
46> T6={struct,[{hello,"asdf"},{from,"1"},{to,{a,"aa"}}]}.
{struct,[{hello,"asdf"},{from,"1"},{to,{a,"aa"}}]}
47> moc...
For the API script of followcost.com. It is given that for using the follow cost API follow cost has a simple JSON API.
Send a GET request to followcost.com using the Twitter user name:
GET /lof.json
The server responds (formated for clarity):
200 OK
Content-Type: application/json
{"milliscobles_all_time":141.93,
"average_tweets_p...
I am planning a protocol where two applications open a socket between them and send and receive legal json objects.
Can a sequence of json objects be unequivocally parsed, or will I need delimiters, or prefixing each object with its lengths or something like that?
...
I have a PHP script that does the following:
Uses file_get_contents() to get content of html file
Echos a JSON object
The issue is that the value obtained from file_get_contents is multi line. It needs to be all on one line in order to be in correct JSON format.
For example
PHP File:
$some_json_value = file_get_contents("some_htm...
I am using the JQuery Validation plug-in and Ajax for my page. Validation works fine when I leave every thing blank. It also works fine if I enter fields besides the SKU field (the one which AJAX is being used for). I get the problem when I enter something into the SKU input but not the other inputs. When I do the this I get an error: "E...
I'm trying to load data from an external .js file, containing a json representation of a bunch of data. I cannot for the life of me figure out how to access the data inside the page. I'm sure this is really easy and I'm missing something simple! right now, I'm trying this:
$(document).ready(function(){
$.getJSON("http://api.crunch...
I can't get access to the DataContractJsonSerializer method from System.Runtime.Serialization.Json
If I do:
using System.Runtime.Serialization.Json;
I get an error...
How can I access this in my Asp.Net Mvc app so I can use the DataContractJsonSerializer method
...
I'm using the Google Map API to retrieve city + state/region information from a postal code lookup. The issue is that in some cases a postal code lookup won't retrieve a city name. An example is 92625 (U.S).
var g = new GClientGeocoder();
g.setBaseCountryCode('US');
g.getLocations('92625', function(response){
if (response) {
va...