json

How can I parse JSON in Google App Engine?

I'd like to parse a JSON string into an object under Google App Engine (python). What do you recommend? Something to encode/stringify would be nice too. Is what you recommend built in, or a library that I have to include in my app? Is it secure? Thanks. ...

Deserialize jSON Google Ajax Web API

I've got this JSON coming back like this: {"responseData": {"results":[{"GsearchResultClass":"GwebSearch","unescapedUrl":"http://www.hellomagazine.com/","url":"http://www.hellomagazine.com/","visibleUrl":"www.hellomagazine.com","cacheUrl":"http://www.google.com/search?q\u003dcache:QzMhUCC4zBoJ:www.hellomagazine.com","title":"\u003cb\u00...

How to get around SerializeJSON in CF8 encoding non printable characters?

SerializeJSON creates JSON with non printable characters (i.e. ASCII 21) This is invalid JSON. How can I get round this. Would a regex removing the non printable characters work? What regex would remove non printable characters? ...

How can I make DataContractJsonSerializer serialize an object as a string?

I have a struct in C# that wraps a guid. I'm using DataContractJsonSerializer to serialize an object containing an instance of that class. When I was using a guid directly, it was serialized as a plain string, but now it's serialized as a name/value pair. Here's an NUnit test and supporting code that demonstrates the problem: privat...

Return JSON wrapped in a callback function from a WCF REST web service

I have a web service returning JSON, but now I'd like to modify it to allow callers to specify a callback function so the return goes from: JSON DATA to specifiedFunction(JSON DATA); The way I'm returning JSON right now is just by returning an instance of an object and having .NET do its serialization magic, if I change to just returning...

Does anyone know a JSON, JS Array parser in Java and/or PHP ?

I need a JSON, JS Array parser in Java and/or PHP. Do you know any parser ? regards, ...

JSON Serialization with class inheriting from Dictionary<T,V>

I have a class that's currently inheriting from Dictionary and then adds a few first class member properties to it. Roughly: public class Foo : Dictionary<string, string> { public string Bar { get; set; } public string Baz { get; set; } } Upon serializing an instance of this object to JSON however, it appears that the serialize...

ASP.NET MVC - Combine Json result with ViewResult

Can I return a Json result that contains also a rendered view? I need it to return the new ID of a submitted form along with its HTML and some other properties. Also that can be helpful when I need to return two (or more) view results from one action inside a Json object. Thanks! ...

Check for a value in a JSON object

I need to find out if an id occurs in my JSON object, for example: { "requested": "2009-07-25T14:12:25+01:00", "channels": [ {"id": 1, "name": "General", "created": "2009-07-25 14:00:02"} ] } Specifically I need to check if my id (say, 2) occurs in channels.i.id. How can this be done? ...

Basic JSON question: How to parse JSON?

I am new to JSON and trying to recover some text from a JSON variable. The JSON variable is sent from a Javascript File and has this structure: foo({ "query": { "count": "2", "created": "2009-07-25T08:17:54Z", "lang": "en-US", }, "results": { "result": [ { "abstract": "<b>Pizza</b> Hut®. Order Online for Deliver...

What are some specific circumstances in which you used JSON over XML?

I still haven't really used JSON in a real world project - I pretty much always rely on XML. ...

Serialize form to JSON with jQuery

How do I serialize all elements of my form to a JSON object? I'd like to have some way of automatically building a JSON object from my form, without having to loop over each element. I do not want a string, as returned by $('#formid').serialize();, nor do I want the map returned by $('#formid').serializeArray(); ...

How to get subset of string using Javascript/JQuery/JSON?

Hi, I want to get a subset of a string in Javascript. Currently, I only know how to store the entire string: I have this as a JSON variable with a callback to foo: foo({"results":[ "<div id=\"following\"><span><a href=\"http://twitter.com/barackobama\"&gt;Obama&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;" ]}) And this is my callback function:...

C# JSON WebClient Request throwing ex

Not really sure why I'm getting the exception.. the code is sound and the API is working through my browser. var url = new Uri("http://octopart.com/api/search?keywords=" + topic.Text); WebClient octopartCall = new WebClient(); octopartCall.OpenReadCompleted += new OpenReadCompletedEventHandler(Octopart_Completed); ...

Multiple same PartialsViews and Json

Hey there. This may already have an answer here but I can't seem to find the right search string so.. I have, almost the same as the comments in SO, a page that has many instances of the same PartialView. The partial view has a button in it that when pressed adds a comment associated to the product the PartialView represents. I can e...

jQuery getJSON callback does not work - even with valid JSON - and seems to be using "OPTION" request not "GET"

Hello, The background is that I've got a celery distributed job server configured with a Django view that returns the status of a running job in JSON. The job server is located at celeryserver.mydomain.com and the page I'm executing the jQuery from is www.mydomain.com so I shouldn't need to consider JSONP for this should I, as the req...

PHP is_json function?

Does anyone know of a robust, (and bullet proof) is_JSON function snippet for PHP? I (obviously) have a situation where I need to know if a string is JSON or not. Hmm, perhaps run it through a JSONLint, but that seems a bit overkill. ...

Can't get a JSON object to return from ASP.NET web servive using jQuery

I am finding many "solutions" to this seemingly common problem, but alas, none seem to work for me - of course. I have some jQuery code that is trying to post to an ASP.NET 3.5 web service. The web service is supposed to return some json. I am getting 501 Internal Server errors with the code below, but according to the solutions found...

Json and Multiple PartialViews

I'm going to re-ask this question in a slightly different way. Say I have 2 or more of the [same] partial view on the page. On this PartialView there is a text box and a button. On the click of the button I need to take the contents of the textbox and do a Json postback, do some stuff and return a result set. The problem I have is th...

What's a common way to test an API that makes requests that return very dynamic JSON

We've written a .NET wrapper API for a set of web services. All this does is make requests and return JSON data. What's a good way to build a test framework for this? I can't think of how to do unit tests since I'd have to know the expected JSON string I'm getting back and that's very dynamic and complex. I thought of doing a WebTest but...