json

PHP - JSON Data Parsing

All, I have the following JSON Data. I need help writing a function in PHP which takes a categoryid and returns all URLs belonging to it in an array. Something like this:: <?php function returnCategoryURLs(catId) { //Parse the JSON data here.. return URLArray; } ?> { "jsondata": [ { "categoryid": [ ...

rate my code: on the spot interview with startup

1.5hr of coding in their smaller than by bedroom office with 4 desks lol. Afterward, while destressing at a bar, I refactored it a bit. objective was: develop a mechanism to define a schema for json objects and validate against it coerce data to schema types if possible, in case an int came in as a float or str develop mechanism to co...

in JSON, Why is each name quoted?

The JSON spec says that JSON is an object or an array. In the case of an object, An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. ... And later, the spec says that a string is surrounded in quotes. Why? Thus, {"Property1":"V...

jQuery 1.4 breaks my program

Hi, I am pulling html from my database with a jquery ajax request. However, if there is a single quote ('), I get a parsing error. Regular quotes work fine ("). For example, in my database I have: style=font-family:"times' new roman" (I put the ' in there after times for testing). With the ' gone it works... I start the request: ...

Cannot serialize parameter of type 'System.Linq.Enumerable... ' when using WCF, LINQ, JSON

I have a WCF Service. It uses Linq-to-objects to select from a Dictionary. The object type is simple: public class User { public Guid Id; public String Name; } There is a collection of stored in a Dictionary<Guid,User>. I want to have a WCF OperationContract method like this: public IEnumerable<Guid> GetAllUsers() { ...

Call external json webservice from asp.net C#

I need to make a call to a json webservice from C# Asp.net. The service returns a json object and the json data that the webservice wants look like this: "data" : "my data" This is what I've come up with but I can't understand how I add the data to my request and send it and then parse the json data that I get back. string data = "te...

Oracle 9i - Convert Varchar2 to javascript escaped UTF-8?

Hi, I need to write a plsql function that will take a varchar2 column containing Polish national characters to escaped UTF-8, which will be then used in javascript, So I need to convert: zażółć gęślą jaźń to: za\u017c\u00f3\u0142\u0107 g\u0119\u015bl\u0105 ja\u017a\u0144 To be exact, my goal is to build a json encoder directly i...

JTemplates serialization

I've been working with the JTemplates plugin which I've used to create a form that is bound to a json object via a template. Works perfectly. What I would like to do though is instead of submitting the form I'd like to re-serialize it back into the json object from which it originated and pass it back to the controller method as a json...

ASP.NET, determine if a request content type is for JSON

I'd like to implement an extension method IsJsonRequest() : bool on the HttpRequestBase type. In broad terms what should this method look like and are there any reference implementations? This is a private API. Edit: Suggestion; check if the x-requested-with header is "xmlhttprequest"? ...

JSON to PHP, then foreach?

I send a valid JSON string to my PHP page from jQueryscript: var data = '{ "data":[ { "id":"12", "checked":"true" },{ "id":"4", "checked":"false" },{ "id":"33", "checked":"false" } ] }'; $.post ("page.php", { data_input:data }, function (data) { // code }); Once I get the data in my PHP page, I parse it ...

jQuery with json

Hi there people, I need help urgently please, my issue is this: I have an MVC app that does a lot of work with jquery ajax (post), to retreive customer info and load it to the web page. The problem is, that on internet explorer 7, when I click twice a link that retreives the info via ajax ($.post or $.getJSON), the info doesn't refresh;...

RSS/JSON reader with jquery (convert to plug-in?)

I am using Yahoo pipes to create a feed for a website. I cobbled together from examples online a decent rss feed reader, then I started adding bells and whistles to it. I get a visual error when I click the next link to quickly. Also there seems to be a script error that happens on ie8, but I don't use it so I cannot verify. It looks lik...

AJAX and Client-Server Architecture with JavaScript

I have to program websites, but I rather don't like the static HTML nature. I prefer more of a client-server architecture. Now I've figured, that with XMLhttp, you can basically dynamically update your page and send/request for information/action to/from a server. So this would basically cover the client area. But to complete a client-...

Is it possible to use OutputCache on mvc JsonResult controller methods?

I am trying to do this, and it leads to result with contentlen 0 It looks like: [OutputCache(Duration = 36000)] public JsonResult GetFileClasses() { return this.Json(TopicConfig.FileExtensionsSettings.List) } Any ideas? ...

Asp.Net MVC Utility Controller Action for filtered dropdown lists...

I was thinking of creating a UtilityController that only contains actions which return json because I might have several forms with a province/state dropdown and a country dropdown. These dropdowns are filtered by selection with ajax...only show prov/state in selected country. What do you think about this idea...is it good...bad...neith...

refer to an element of JSON (Javascript) object.

How do I refer to an element of JSON (Javascript) object. exampe: alert(homes.Agents[1].name); <script> var homes = [ { "Agents" : { "name" : "Bob Barker", "name" : "Mona Mayflower" }, "Listings" : [ { "h_id": "3", "city": "Dallas", "state": "TX", ...

Designing a web service to be used by the iPhone and a web client

I'm designing a web service that serves up JSON through a REST API. This API is currently being used by an iPhone app to do CRUD operations. My question is, can I design a web client that uses this REST API using nothing more than ExtJS (or some other RIA framework) and HTML pages? In other words, can I create a static HTML page that us...

Web services on iPhone

Which is better to parse JSON/XML on iPhone, so that i can interact with web apps. Also which is the fastest and most efficient parser out there ...

fullcalendar settings via ajax

Hi, I would like to pass fullcalendar settings (i.e. startTime, endTime) via ajax. I would like to have something similar to this: eventSources: [ "events.php", "settings.php" ] where events.php holds events array, settings.php holds settings array. If this approach works, how can i use settings values? If settings.php generates jso...

JSON in C#; Sending and receiving data

I am trying to make a desktop client for Request and Response application. I am able to do GET requests easily. But I was wondering whether someone could help me work out how I could do a JSON request and response. and parse it to a string, from there I can workout how to slit it all up, thanks. ...