json

Viewing JSON output in a simple WCF rest service

Hello, How do I access this WCF function through the browser and view the JSON code... [OperationContract] [WebInvoke(Method="POST",BodyStyle=WebMessageBodyStyle.Wrapped,ResponseFormat=WebMessageFormat.Json)] string GetData(int value); Here's the code in my service...its just a sample function... public class Service1 : IService1 ...

Json + java, cannot get an item

Hello, I do not manage to get the latitude, longitude from the following json (hold in json variable) I get from a http request: { "name": "rue de la paix, paris, france", "Status": { "code": 200, "request": "geocode" }, "Placemark": [ { "id": "p1", "address": "Rue de la Paix, 75002 Paris, France", "AddressD...

Why do JavaScript objects not have a toJSON() method?

As described at http://www.json.org/js.html, JavaScript objects can dictate how they are serialized by JSON.stringify() by implementing a toJSON() method. For an arbitrary object, this method is not defined, while numbers and strings seem to implement the method. I'm curious--why do objects not have an implementation? EDIT: I originally...

MFC :: Modify the values in a json file

Hi All, I'm able to parse json files in MFC but is having a hard time modifying the values. Is there an easier way writing new values, other than converting it to native file types, modifying the contents and converting it back to json again? I thought it would be as easy as changing values in an XML file where you just look for the ta...

How to send an array of object from iPhone app to a PHP Script with JSON

I have an iPhone app with an array of objects that I want to send to a PHP script and have them be stored in a mySQL database. The objects in the array contain only floating points and strings, nothing special. From what I understand the best way to send the array to the php script is to convert the array into an JSON, send it to the ...

Protocol Buffers versus JSON or BSON

Does anyone have any information on the performance characteristics of Protocol Buffers versus BSON (binary JSON) or versus JSON in general? Wire size Serialization speed Deserialization speed These seem like good binary protocols for use over HTTP. I'm just wondering which would be better in the long run for a C# environment. Here...

Retrieve Facebook Fan Names

Hi everyone, I'm trying to grab the names of fans of a Facebook fan page that I administer. I've done some snooping around, and apparently, the FB API doesn't support that, but Facebook actually uses AJAX/JSON to populate the list. Anyways, can anyone suggest a way to make that call myself and grab the data as plain text? Also, I've fo...

Is it valid to define functions in JSON results?

Part of a website's JSON response had this (... added for context): {..., now:function(){return(new Date).getTime()}, ...} Is adding anonymous functions to JSON valid? I would expect each time you access 'time' to return a different value. ...

Browser freezes during javascript eval()

I'm using eval() in javascript to evaluate a significant amount of js code (not just json, but function calls too). The browser freezes during the call, i.e. the user cannot scroll the browser or click anything. Is there any way around this freezing problem? ...

Json and Circular Reference Exception

I have an object which has a circular reference to another object. Given the relationship between these objects this is the right design. To Illustrate Machine => Customer => Machine As is expected I run into an issue when I try to use Json to serialize a machine or customer object. What I am unsure of is how to resolve this issue as...

JSONPath :contains filter

Hey all, I was wondering if any knew of a way to use a regular expression or wildcard operator (or pehaps '%LIKE%' in SQL) so I could use JSONPath to do searching within a large set of JSON data. For instance (and yes, I'm parsing, not eval( )ing my data in the app): var obj = eval ( '({ "hey": "can you find me?" })' ); And I'd like ...

Best way to save complex Python data structures across program sessions (pickle, json, xml, database, other)

Looking for advice on the best technique for saving complex Python data structures across program sessions. Here's a list of techniques I've come up with so far: pickle/cpickle json jsonpickle xml database (like SQLite) Pickle is the easiest and fastest technique, but my understanding is that there is no guarantee that pickle output...

google app engine jsonpickle

Has anyone got jsonpickle working on the google app engine? My logs say there is no module but there is a module as sure as you're born. i'm using jsonpickle 0.32. <type 'exceptions.ImportError'>: No module named jsonpickle Traceback (most recent call last): File "/base/data/home/apps/xxxxx/xxxxxxxxxxxxxxxxx/main.py", line 4, in <modu...

JSON Serialization/Deserialization mismatch (ASP.Net)

Hi, When I call a PageMethod in my page, the serialized object looks like: {"d":{"__type":"MyAsembly.MyNamespace.Person","Name":"ulu","Age":40}} This is ok for Javascript, but my .Net deserializer won't understand it: var result= new JavaScriptSerializer(new SimpleTypeResolver()).Deserialize<Person>(source); throws System.InvalidOpe...

Javascript Objects: Accessing object variables from methods

Hi all, Quick question, and one I am yet to work out on my own. I'll start with an example. object = { somevariable: true, someothervariable:31, somefunction: function(input){ if (somevariable === true){ return someothervariable+input; } } } object.somefunction(3); Obviously this won't wor...

How do you return a JSON object from a Java Servlet

How do you return a JSON object form a Java servlet. Previously when doing AJAX with a servlet I have returned a string. Is there a JSON object type that needs to be used, or do you just return a String that looks like a JSON object e.g. String objectToReturn = "{ key1 = value1, key2 = value2 }"; ...

JSON post works in IE, not in FF

I have an asp.net MVC app. One of the forms posts json data to a public method (not an action, perhaps it will be later) on the controller. This works great in IE 8. However, it does not work in Firefox 3.5. The view is a list of jquery sortable objects inside of a form. Here is a stripped down version of the form: <form class="c...

Should I use an XMLHttpRequest /JSON or an iFrame?

I have been making extensive use of XMLHttpRequests and JSON to fetch from a MySQL database and return records as arrays. It works perfectly. Additionally, I have three cases in which I have the server (via PHP) formatting the data as a web page and creating bar charts (as opposed to sending arrays back to JavaScript for processing). Cu...

soap vs REST vs JSON in SOA

I writing here to clear my and may be many people 's misconceptions about them... first my question is: SOAP is xml based protocol REST is web based architectural web service JSON is standard but not xml based how can we compare them???? as trio are different things 2nd question is: is REST response xml based only or json based a...

iPhone - accessing a NSDictionary

Hello! I have a JSON String which I transform to a NSDictionary, and the I get the values for the key "people" to a NSDictionary: NSDictionary *testDict = [jsonString JSONValue]; NSDictionary *peopleDict = [testDict objectForKey:@"people"]; A NSLog of peopleDict NSLog(@"%@", peopleDict); return me the following: { 0 = { i...