I'm creating a web service in WCF that returns JSON, but the DataContractJsonSerializer is balking on some circular references (which I can't remove in this particular case).
Instead, I'd like to use the Newtonsoft json library. What's the easiest way to create a custom serializer in WCF?
Note: I know I could just return a stream, bu...
I have always used the Scriptmanager to handle all AJAX calls, but I am starting to expand and am playing around with using jQuery and JSON to consume an ASP.NET 3.5 Web service. I am using standard jQuery calls as you can see below, which is working wonderfully. I am concerned about security and how to ensure that I am not opening any d...
The default way to output JSON in rails is some thing like:
Code:
render :json => friends.to_json(:only => [:username, :avatar_file_name, :id ])
Output
{"friends" :
[{"user":
{"avatar_file_name": "image1.jpg", "username": "user1", "id": 1}},
{"user":
{"avatar_file_name": "image2.jpg", "username": "user2", "id": 2}},
...
Fist off, here's the jSON object I created with PHPs json_encode function
{
"Gatwick":[
{
"destination":"VCE",
"destination_name":"Venezia Marco Polo"
},{
"destination":"VCE",
"destination_name":"Venezia Marco Polo"
},{
"destination":"VCE",
"destination_name":"Venezia Marco Polo"
...
I have a library with some objects that I use both from C# and JavaScript. There are several objects, let's call one of them Foo, with the same basic implementation in C# and JavaScript. When I want to transmit an object of this type from the server to the browser, I simply call Foo.ToJson() to serialize this object to JSON and then revi...
returning HTML in my json array, what things do I have to escape for?
...
Have a glance at this snippet of JSON.
Motivation: The JSON is generated by a REST service & later on will be
converted to XML.
Simple Question: I am currently embedding the map for the error codes inside the JSON snippet, with the intention of helping the transformation to XML. The XML format does not use numeric codes. Should I plac...
I am using a webservice which provides a large result set either in XML or JSON format.
Which format will be faster or better (perfomance based)? Also which language should I use to parse the XML/JSON? Should I use PHP or JavaScript?
...
I'm trying to stringify a multi-array variable into a JSON string in Javascript. The
//i'm using functions from http://www.json.org/json2.js
var info = new Array(max);
for (var i=0; i<max; i++) {
var coordinate = [25 , 32];
info[i] = coordinate;
}
var result = JSON.stringify(info);
But result doesn't look like a JSON string at a...
I create a huge JSON-Object and save it in my database. But when I load the "string" and echo it in PHP, I can't access the JSON Object in JQuery. Do I have to consider something if I want to save my JSON Object in a MySQL Database (when I just create the Array and then echo it with "echo json_encode($arr);" it works fine, but I need to ...
I asked for PHP login system and I got answers,
lots of files tactics
* aaa.txt(content is aaa-pass)
* bbb.txt(content is bbb-pass)
* and scandir.
XML
CSV
MySQL
SQLite
PEAR::AUTH
But no one mentioned about JSON.
but I feel JSON is the best way for me.
Because it looks easy , and PHP has JSON dedicated built-in fun...
Suppose I declare a structured Javascript variable like this:
var mydata = {'list':[
{'fname':'george','lname':'washington'}
,{'fname':'oscar','lname':'wilde'}
,{'fname':'james','lname':'polk'}
]
,'summary':this.list[1]['lname']
}
Question: How can I ensure that
this.list[1]['lname']
equals 'wilde' and that my "this" is actually re...
I'm currently working on a small application that works like this:
When the user clicks a link, an Ajax GET request is fired.
The request hits a server-side PHP script.
The script, which requests information for another domain, retrieves a JSON feed.
The feed is then echoed back to the client for parsing.
I'm not really a PHP develop...
Hi,
I am generating my JSON manually, and I even escaped for quotes with a preceding backslash. It is causing me problems.
My HTML returned looks something like:
<div class="blah"><div class="a2">This is just a test! I hope this work's man!</div></div>
string json = "MY HTML HERE";
json = json.Replace(@"""", @"\""");
Is there mo...
I read in the following JSON object using ajax and store the object as an array:
var homes = [
{"h_id":"3",
"city":"Dallas",
"state":"TX",
"zip":"75201",
"price":"162500"},
{"h_id":"4",
"city":"Bevery Hills",
"state":"CA",
"zip":"90210",
"price":"319250"},
{"h_id":"5",
"city":"...
I'm trying to develop a stackoverflow.com widget for Mac OS X and I'd like to show the flair for a given username.
The different possibilities described in User Flair are all expecting the ID of a user but I'd like to let the user enter a username, instead.
Is there any way to retrieve the userID for a given username?
Better yet, is t...
My JSON that is being returned from my ASP.NET MVC application looks like this:
{code: "1", error: "0", output: "<div class="a1"><div class="b1">this is fasta's</div></div>}
It is not working because I am not escaping it properly.
I'm not using a JSON library, can someone recommend a function that would clean up my HTML so this works...
I'm getting an array of strings from a JSON object. I want to save these strings in a DB, but only if they're not already in there. What's the best way to compare what's already in the DB with what I'm about to enter, and exclude matches?
I'm using PHP and MySQL. Thanks!
...
I have an ASP.NET MVC action that is returning a JSON object.
The JSON:
{status: "1", message:"", output:"<div class="c1"><div class="c2">User generated text, so can be anything</div></div>"}
Currently my HTML is breaking it. There will be user generated text in the output field, so I have to make sure I escape ALL things that need t...
I'm trying to encode data to JSON in Python and I been having a quite a bit of trouble. I believe the problem is simply a misunderstanding.
I'm relatively new to Python and never really got familiar with the various Python data types, so that's most likely what's messing me up.
Currently I am declaring a list, looping through and ano...