json

Doing a POST to a Service Operation in ADO.NET data services

Is it possible to POST to a service operation defined in an ADO.NET data service (it is decorated with WebInvoke)? I had no problem calling the service operation as an HTTP GET. However, when I switched to doing a POST, the stack trace consistently comes back with "Parameter cannot be NULL". I am using the jQuery syntax below, and send...

how to use ajax with json in ruby on rails

I am implemeting a facebook application in rails using facebooker plugin, therefore it is very important to use this architecture if i want to update multiple DOM in my page. if my code works in a regular rails application it would work in my facebook application. i am trying to use ajax to let the user know that the comment was sent, ...

Parsing JSON to XML using net.sf.json (java)

Hi guys, I'm parsing a generic JSON to a XML using net.sf.json. (I'm not using POJO Obj in the conversion) Json that I'm converting: { "root": { "accountId": "1000", "Items": [ { "cost": 0.1, "debit": 0.1 }, { "cost": 0.2, ...

XMLHttpRequest - JSON - .NET

I am trying to send JSON from my mozilla addon to my asp.net page. var myJSONObject = {"userName": una,"password": pass}; request = new XMLHttpRequest(); request.open("GET","http://www.google.com?jo=" + myJSONObject,true, null, null); on my .net page I have tried several ways of doing it but not able to find the best way...

JSON and jQuery.ajax

Hello, im trying to use the jQuery UI autocomplete to communitate with a webservice with responseformate JSON, but i am unable to do so. My webservice is not even executed, the path should be correct since the error message does not complain about this. What strikes me is the headers, response is soap but request is json, is it suppose...

How could I refactor this into more manageable code?

Is this code even complex enough to deserve a higher level of abstraction? public static JsonStructure Parse(string jsonText) { var result = default(JsonStructure); var structureStack = new Stack<JsonStructure>(); var keyStack = new Stack<string>(); var current = default(JsonStructure); var currentState = ParserS...

ASP.NET (C#) jQuery JSON data problem

My JSON Data {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} jQuery code: $(document).ready(function() { $("#Button1").click(func...

Why am i getting same values of different JSON date values?

I do not know the reason why am i getting same values of different JSON date values. Here is my code for parsing date values in JSON date format: package com.jsondate.parsing; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget...

Generate lightweight JSON using DataContractJsonSerializer

I'm trying to generate JSON using C# and DataContractJsonSerializer in .Net 3.5. The problem is that I can't figure out how to build the structure correct for the result I need. I've tried to reproduce PHP's associative arrays using both hashtables, list objects and arraylists but can't figure out how to generate my result in the best w...

JavaScript array to PHP array then process in PHP and return

Example: javascript: var mycourses=new Array(); mycourses[0]="History"; mycourses[1]="Math"; mycourses[1][0]="Introduction to math"; mycourses[1][1]="Math 2"; mycourses[1][2]="Math 3"; PHP will then run these values through functions (please note values are mostly not strings as in the example above but rather numbers), the ...

JSON implementations that handle sparse arrays

I need to know if any JSON implementations can handle sparse arrays to my satisfaction. I've seen the question: http://stackoverflow.com/questions/1733658/how-to-represent-a-sparse-array-in-json but using an object rather than an array is not an option for me; I need an array. My minimum requirement would be that the implementation f...

Create JavaScript array of function pointer, without calling it

I have the code below. I would like to have an array (buttons) with a single element pointing to the a function (closeFlag). <script type="text/javascript"> var closeFlag = new function() { alert('Clicked'); } var buttons = { 'OK': closeFlag } </script> However, when loading the page the alert immediate...

fetching a url using $.getJSON and parsing it correctly

This is probably really stupid but i can't find the problem with my code. It fetches a url that returns json and the function is then supposed to return a string: function getit() { var ws_url = 'example.com/test.js'; var user = false; $.getJSON(ws_url, function(data) { alert('user '+data.user);//shows john user = data.us...

Ruby - Get request body from incoming http call

Hi, I am receiving http requests to my rails application to a url /account/postback The body of this incoming request contains some json that I need to retrieve, how can I do this in ruby? Thanks, Andy ...

Is PHP's json_encode guaranteed to produce ASCII string?

Well, the subject says everything. I'm using json_encode to convert some UTF8 data to JSON and I need to transfer it to some layer that is currently ASCII-only. So I wonder whether I need to make it UTF-8 aware, or can I leave it as it is. Looking at JSON rfc, UTF8 is also valid charset in JSON output, although not recommended, i.e. som...

How do i make formatted json in C#.NET

I am using .NET json parser and i would like to serialize my config file so it is readable instead of {"blah":"v", "blah2":"v2"} to something nicer like { "blah":"v", "blah2":"v2" } my code is something like using System.Web.Script.Serialization; var ser = new JavaScriptSerializer(); ...

JSON encoding on RTL languages

Hi, I'm using JSON to integrate open flash chart to my web page. When I have a Right to Left language string which contains more the one word the JSON encodes it backwards (For example: "Hello world" is encoded as "world hello"). The string is extracted from a database, there for can be of any language. How do I force the correct enc...

.NET PostSubmitter sends backslashes

Hi, I'm using C# to send JSON to a PHP-Script, like this: string json = "{"; json += "\"prop\":\"some text\""; json += "}"; PostSubmitter post = new PostSubmitter(); post.Url = "http://localhost/synch/notein.php"; post.Type = PostSubmitter.PostTypeEnum.Post; post.PostItems.Add("note", json); post.Post(); Of course I'll have to escape...

JQuery Validation using Remote posts empty data to webservice

I'm using the JQuery Validation plugin. I'm using the remote option to make a call to my webservice to check if a company name exists. The webservice only accepts JSON data. I pass the data to the webservice from the Company Input Field in my Form as follows: data: "{'company': '" + $('#Company').val() + "'}" But this always returns a...

3 questions about JSON-P format.

Hi, I have to write a script which will be hosted on differents domains. This script has to get information from my server. So, stackoverflow's user told me that i have to use JSON-P format, which, after research, is what i'm going to do. (the data provided in JSON-P is for displaying some information hosted on my server on other websi...