json

drupal json server, objects with ## symbol in javascript?!

I am using the services module in drupal a long with the JSON Server, and I am accessing it using jQuery this works great, but I have one small problem. Drupal/JSON Server always seem to return objects with the # symbol, which I don't really know how to handle, this prevents me from doing object.property Because in reality it's object...

Dynamically generating a dropdown using json data?

I have developed a script that receives json data from a php script using $.getJSON. The JSON data looks like '[{"options":"smart_exp"},{"options":"user_intf"},{"options":"blahblah"}] ' <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; <script type="text...

ASP.Net MVC: how to create a JsonResult based on raw Json Data

Having a string containing the following raw Json data (simplified for the sake of the question): var MyString = "{ 'val': 'apple' }"; How can I create a JsonResult object representing MyString? I tried to use the Json(object) method. but it handles the raw json data as an string -logically :P-. So the returned HTTP response looks...

Jersey web services multiple formats

In following method: @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN}) @Path("{id}") public String getMessage(@PathParam("username") String username, @PathParam("id") int id, @QueryParam("format") String format) { return "test"; } how do I return the the data in the specific fo...

Run a json string function

I have a json string like this: json = "{'run': 'function() { console.log('running...'); }'}" How do I run that function inside of the json string? ...

How to declare a json string correctly?

So I tested two ways of declaring a json string: 1: json = "{'name': 'ajsie'}"; obj = JSON.parse(json); // SyntaxError: Unexpected token ILLEGAL 2: json = '{"name": "ajsie"}'; obj = JSON.parse(json); // Worked! What is the problem with the first one? ...

How do I get the interested_in value from the Facebook SDK wrapper for the iPhone?

I'm coding using the Facebook SDK for iPhone. According to the documentation, a User has a property called interested_in. However the JSON request which I make doesn't seem to include this property. {"id":"635332621","name":"Joe Schmoe","first_name":"Joe","last_name":"Schmoe","link":"http:\/\/www.facebook.com\/profile.php?id=635332621",...

PhoneGap.exec() passing objects between JS and Obj-C

The only way I found to passing objects between the JS and Obj-C it's by encoding the JS object by using JSON.stringify() and pass the json string to PhoneGap.exec PhoneGap.exec('Alarm.update',JSON.stringify(list)); ... and rebuild the object in Obj-C: NSString *jsonStr = [arguments objectAtIndex:0]; jsonStr = [jsonStr stringByRe...

Android JSon Object Not readable in dotnet webservice for insert operation in REST

hi, Json object is returned to a webservice which gets the i/p as [OperationContract(Name = "Create")] [WebInvoke(UriTemplate = "/Create/Data", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)] bool CreateCustomer(StringBuilder objCustomer); //in my service file im d...

Best practice for checking data types at runtime objective-c

Hi all, I have JSON data being provided to my application but unfortunatly it is not very well formed. Sometimes I am getting String representations of numbers when I am expecting numbers. For some reason some values may have a prefix of whitespace. What is the best way to deal with this? Currently I am forced to check the types vi...

Securing JSON with a codeigniter and jQuery project.

I would like to use JSON, however, the security issues related to using JSON are holding me back. There are two main issues CSRF (Cross Site Request Forgery) and the JSON/Array hack. I have read that Double Submit the Cookie expanding from Secret Hidden Fields are possible solutions to the CSRF problem. I wonder if there are any co...

another way to send data to view from controller action rather than json in "this" situation.

Hi, I am developing the full calender of jquery from some blog. I added my questions with concern this, but this question bit different. Full description of code is given here But not get satisfactory answers, so need to change the strategy . in this (in link given) code , action of controller returns the Json output and j query accepts ...

JSON character encoding

Hi, My Java web application submits an AJAX request that returns JSON such: {'value': 'aériennes'} When 'aériennes' is displayed in the webpage, it appears as 'a�riennes', so I guess there's some kind of character encoding problem. The AJAX response headers include Content-Type application/json which doesn't appear to include a...

zend framework posting json via rest

Hi guys, Im trying to build an authenticating api with rest and also post a large object. Im talking about posting number of items such as some information about a car and its owner and store the information at a db level. is rest the way to go with this or use soap ? and if so any ideas how i can post json objects ? Much appreciate it....

Serve JSON "as is" from Spring controller using content negotiation

In my webapp, all my message converters are in place, and if I change getContent below to return a bean/pojo, it returns as " application/json;charset=UTF-8", which is expected, but I now want to serve JSON "as is". E.g. I have a simple stub web service with which users can PUT a blob of JSON content which is persisted somewhere, and th...

I am creating a javascript object based upon a json string, I want my IDE to offer intellitext to its properties

I could find out the object properties by looking at the source json string - however is there anyway to do this using an IDE and intellitext ? Currently I am using webstorm with my live deploy - but to no avail the object properties are not revealed ... ...

What is the difference between {active: "yes"} and {"active": "yes"}?

I've used FireBug to test the two cases and they seem pretty similar by result: >>> var x = {"active": "yes"} >>> x.active "yes" >>> var x = {active: "yes"} >>> x.active "yes" But I'm pretty sure there is some difference between these two, maybe even performance related difference. Bottom line - I'd like to know if there is a differen...

WebApp that communicates using only json objects?

Hey everyone, I've been thinking about how the majority of web apps works at the moment. If as an example the backend is written in java/php/python what you probably see is that the backend is "echoing / printing" the html ready to the browser, right. For web apps that works using almost exclusively ajax, is there a reason to not simpl...

Why is there a need to send JSON as string while passing parameters to WCF from jQuery

Until yet I was using httpHandlers for performing all server side logic and these httpHandlers were being called by jQuery $.Ajax. In this case to pass any parameter I used to pass pure JSON object (obviously key value pairs) which was automatically translated to the Request.Form keys on serve side. Now as I am trying to call WCF endpo...

Parsing JSON on Windows Phone 7

I'm trying to do some simple JSON manipulation on the Windows Phone 7. JSON.NET looks great, but VS2010 complains when I try to add a reference to it. It let me add the Silverlight dll, but warned me that it could result in weird app behavior, so I'm skeptical that it would actually work. This looks like a fine way to serialize and des...