json

recursively loop over javascript object?

Hi there. I am trying to create a function which, When given an object will output something like <div> reason : ok status : 0 AiStatistics : null CurrentSeasonArenaStatistics : null <div> Player <div> CampaignProgressCoop : CompletedLegendary CampaignProgressSp : PartialHeroic <div> ReachEmblem <div> ba...

Consuming a Microsoft Web Service with jQuery

Hi evertbody, I'm trying to consume a WCF webservice using jQuery. The returned Json data is: { "ListOfPersons": "[ {'Id':1,'FirstName':'Foo','LastName':'Bar'}, {'Id':2,'FirstName':'Hello','LastName':'World'}, {'Id':3,'FirstName':'Tanks','LastName':'Giving'}, ]" } These are the ...

Post array to ASP.NET MVC 2 Controller using AJAX

Hello. There is known trouble with sending array to ASP.NET MVC controller. I've found a lot of solutions like that. Why don't use usual object instead array? It works good. Example of code: <script> $(function(){ $('.asArray').click(function(){ var array = Array(); array[0] = 'Dima'; ...

Display an escaped Json field with Javascript

How can I read an invalid Json returned string with Javascript (jQuery or not)? For example, the first FirstName will not be displayed as it contains an escaped character. So, I will get : undefined. { "ListOfPersons": [ {"Id":1,"FirstName containing doublequotes (ex: \") ":"Foo","LastName":"Bar"}, {"...

Using JQuery getJSON with other JavaScripts included gives ReferenceError

I made a small example HTML page to get JQuery's getJSON method working. It looks like below (sorry for the sloppiness, this was just a proof of concept to then later add into a larger project): <script type="text/javascript"> function test() { $.getJSON("http://api.flickr.com/services/rest/?&amp;method=flickr.people.getPublicPhotos...

json to java pojo with a map via GSON

My java pojo looks like this public class myPersonTO{ String name; String surname; Map<String, Double> categories; } I am using the gson library, however I an not sure what my json stringn, and the object it is created from should like; I am using json stringify, on a javascript object containing two strings and an array of obj...

jtemplates append instead of overwrite

Hi all, I'm using jtemplates (jquery plugin) as my templating solution which rocks by the way! I replaced my asp.net updatepanels with this and my god what a speed booster. The problem I have however is that I'm loading user comments under an article with this templating system. I'm processing the template like this: function ApplyTem...

How to make json array parsing work on the server side.

Hello, I have an action on my server side: public void Action(Container container) { } where container is: public class Container { public string[] Arr; } From the client side, I'm invoking this action in the way below: $.post("Controller/Action", { Arr: "abc" }, null, "json"); After this, the Arr in container contains one e...

Coop API - posting with PHP

I'm trying to do a simple post to a web service using CURL and their API but I'm getting a 422 response. My code looks like: include 'CurlRequest.php'; $secret_key = 'mykeyhere'; $group_id = 'group_id'; $postData = array( 'group_id' => $group_id, 'key' => $secret_key, 'status' => 'test' ); $curl = new CurlRequest('http://...

Problem with RestEasy and JSON

Hi, I am using RestEasy to marchal entities to JSON. That works okay but somehow every thing is represented as a String. e.g. @XmlRootElement(name="TestObject") public class TestObject { private Long value; public Long getValue(){ return value; } } Instead of creating something like: {TestObject:{value:1234}} It ...

Can I send instance variables to Tequila (.jazz) JSON Parser? (Ruby on Rails)

I am using the great Tequila-JSON Parser ( http://github.com/inem/tequila ) in an Web-application, to render more or less complex JSON server-replies. More and more the JSON-Templates (.jazz) are growing in somehow real "views". I am trying now, to get an instance-variable from the according controller, into the .jazz template, but this ...

Using an API (JSON) with Flash (AS3)

Hi all. I want to build an application with Flash CS5 that will use an API that returns responces in JSON. How can i do it in Flash? Another question that can go in this thread is... How can i use an AJAX API like Google's transliteration with Flash? ...

http json post and rails polymorphic association

I want to update two table of my database with a http post request (JSON format) from my android app. my models look like this: class Ecg < ActiveRecord::Base has_one :record, :as => :payload end class Record < ActiveRecord::Base belongs_to :payload , :polymorphic => true belongs_to :user end an my record cotroller look...

Calling a WCF Rest method with JSON as the Response Format asks to download the file?

This is related the following question, but I thought I would create another post so that question would not become too convoluted: When I changed the ResponseFormat to XML, the browser return the response correctly, but if I try to use JSON as the ResponseFormat, it asks me if I want to download the file. Just to see what is in the fi...

Can't Read Twitter Json

I'm a total loss. I have this function to read the Twitter Json. The Json is valid but the value is coming back as 'undefined' when I run it. $.getJSON("http://twitter.com/users/show.json?screen_name=starbucks&amp;callback=?" , function(data) { var testing = (data.length); alert(testing); }) ...

Formatting the Json serializarion in a .NET Web Service

Hi everybody, I have the following .NET web service with the following signature (IServices.cs): [OperationContract] [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)] string ReturnListOfPersons(); The implementation is (in the Services...

XMLHttpRequest cannot load an URL with jQuery

Hi everybody, I'm trying to get some json data from a "remote" website. I run my web service on the 99000 port then, I launch my website on the 99001 port (http://localhost:99001/index.html). I get the following message: XMLHttpRequest cannot load http://localhost:99000/Services.svc/ReturnPersons. Origin http://localhost:99001 is ...

Parsing the Data in JSON Response

Hello Team, Here I am posting the Json Response: {"ResultSet": {"Result":[ {"Phone":"(650) 473-9999", "Distance":"2.59", "MapUrl":"http://maps.yahoo.com/maps_result?q1=441+Emerson+St+Palo+Alto+CAgid1=28734629", "Categories": {"Category":[ {"content":"Salad Restaurants", ...

How to make a cross domain AJAX POST call from a Sharepoint Webpart?

I need to call a (HTTP) REST API as as POST call - basically, it allows me to post a message to a forum/community. Since, there is currently no way of authenticating over the API, I need to depend on browser cookies. ie, have the user logged in to the community and then use the API calls. This means, server proxies are ruled out. And b...

WCF Ajax Service Returns Blank to jQuery's Requests

I have an ASP.NET Ajax service set up using WebSriptServiceHostFactory in the *.svc file - no web.config configuration. In the contract, I'm starting with two very simple methods: [OperationContract()] [WebGet] string GetPersonalInformationLabel(); [OperationContract()] [WebGet] string GetCorporateInformationLa...