json

Can i return an array of "number, number" in json format?

Hi folks, i have a list of lat/long objects on my server. eg. public class LatitudeLongitude { public float Latitude; public float Longitude; } simple. now, can i return a collection of these, in json format .. BUT ... i do not want to list the key, just the values. This means the normal result would be something like ... ...

uninitialized constant error, while using JSON and Facebook connect with rails

I'm following the tutorial here http://applicake.com/posts/54-integrating-facebook-connect-with-rails-applications to set up facebook connect. It almost worked, except for the last step :-( I'm getting a JSON error, inspite of installing the JSON plugin. I did gem install json How do I fix the problem? Error in the view: uninitiali...

Nested object creation with JSON in Rails

How do I pass JSON to a RAILS application so it will created nested child objects in a has_many relationship? Here's what I have so far: Two model objects. class Commute < ActiveRecord::Base has_many :locations accepts_nested_attributes_for :locations, :allow_destroy => true end class Location < ActiveRecord::Base belongs_to :c...

JSON WCF Security

Are JSON enabled WCF service secured as they carry Human readable strings Any article on JSON enabled WCF secrity will help.(link) ...

Simple, secure API authentication system.

I have a simple REST JSON API for other websites/apps to access some of my website's database (through a PHP gateway). Basically the service works like this: call example.com/fruit/orange, server returns JSON information about the orange. Here is the problem: I only want websites I permit to access this service. With a simple API key sys...

issue with parsing JSON string

I have this object which I use as a list of objects: var objList = new Object(); This is then serialized using JSON serialize. If there are no object added or all objects have been removed from the list and the blank objList is serialized, parsing the objList using JSON parser in IE, it will occasionally fail to evaluate the objList a...

JsonArray in silverlight to javascript

I'm creating a JsonArray such as: JsonArray jsonValues = new JsonArray(); for( int i = 0; i < values.Count; i++ ) { var someSingleValue = values[i]; jsonValues.Add( string.Format( "Name: {0}", someSingleValue ) ); } After that I'm shipping json values to my javascript in .aspx page via call: HtmlPage.Window.Invoke("call", js...

How to return a JsonResult in ASP.NET MVC.

Hi folks, i have the following data as a string in my Action method: string json = "[[1,2],[3,4],[5,6]]"; Simple. When I call the Json view, it encapsulates the result in two double quotes. This stops the client side javascript from loading this result into a javascript object. eg. return Json(json); result => "[[1,2],[3,4],[5,6]...

Databases using JSON as storage/transport format

How many database systems there are that use JSON for storage or transport? I know of: CouchDB MongoDB DBSlayer I remember I saw yet another vendor in a SO user's profile. That systems was using what they called binary JSON, but I can't remember the name of the product. Lately, it appears that more and more DB projects are looking t...

xml to json mapping challenge

At first glance, I thought using xml data in javascript would be as simple as finding an xml-to-json library and turning my xml into a javascript object tree. Now, however, I'm realizing that it's possible to create structures in xml that don't map directly to json. Specifically, this: <parentNode> <fooNode>data1</fooNode> <ba...

How do I add extra data to ActiveRecord records being serialized to JSON in Rails?

I'm exposing some resources via a simple API that returns JSON. I would like to inject the path to each of the resources so that the consumer need not construct them. Example of desired output for something like User.all.to_json: users: [ {user: { id: 1, name: 'Zaphod', url: 'http://domain.com/users/1.json' }}, {user...

Parse JSON array

Hi, I fetch a JSON array from a web service with touchJSON. Which looks like this: [{"icecream": {"title": "Banana"}}, {"icecream": {"title": "Strawberry"}}] I'm not able to parse this into a NSDictionary, because touchJSON doesn't support JSON arrays. How do I get my JSON array into a NSDicitionary? Regards ...

Using Jettison to go from JSON to DOM in Java

So far, this is the story of a failure, and any advice is welcome. I tried the following: XMLStreamReader to Document using JAXP with Saxon The code: JSONObject obj = new JSONObject("{\"alice\":{\"bob\": \"a\"}}"); AbstractXMLStreamReader reader = new MappedXMLStreamReader(obj); StAXSource source = new StAXSource(reader); Document do...

JSON Object with Slashes in it

I am serializing to a json object using: public static string ToJson(this object obj) { JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); return jsonSerializer.Serialize(obj); } However when I'm populating a hidden field, I'm getting the slashes with it: "[{\"ImageLink\":\"\",\"ShowOnHomePage\":null,\"Type\...

How to restrict JSON access ?

I have a web application that pulls data from my newly created JSON api. My static HTML pages dynamically calls the JSON api via JavaScript from the static HTML page. How do I restrict access to my JSON api so that only I (my website) can call from it? In case it helps, my api is something like: http://example.com/json/?var1=x&amp;var...

Is there some way to convert json to xml in PHP?

is there some way to convert json to xml in PHP? I know that xml to json is very much possible. ...

Extend the exception thrown from ASP.NET when calling a Webservice from JQuery

I'm using JQuery to load controls dynamically in an ASP.NET development environment using JSON and WebServices. Within this solution I have a business logic layer which has a built in validation mechanism (i.e. validating properties and business rules similar to that of CSLA) When requesting a new control to be loaded dynamically using ...

JSONPath or other XPath like utility for JSON/Javascript; or Jquery JSON

I have been looking at JSONPath and though it seems pretty well done, I wonder if anyone has worked with it and can comment on its usability, or can recommend alternatives? What would be really slick is if there was a plugin for JQuery that did something like this. I have been searching the plugins and coming up empty handed. Anyway, ...

Passing primitive type to WCF RESTful service

I've been banging my head against the wall for the past couple of hours, here's what we're trying to do: a method expects a primitive/simple type as the request body. Originally we tried with a boolean, but that didn't work so we tried with string and object. Same thing. Here's the server-side code [OperationContract] [WebInvoke(UriTem...

Ajax autocomplete issues

I'm having some issues with an asp.net implementation of this JQuery facebook style autocomplete. Basically the json url I am using is an aspx page that takes some paramaters via the query string and writes json to the response. This appears to be functioning correctly however the plugin doesnt recognise it. The strange thing is when ...