I wanted to use YAML but there is not a single mature YAML library for Erlang. I know there are a few JSON libraries, but was wondering which is the most mature?
Can ViewData be set & returned in an ActionResult that returns Json() ? Im asking because It's not working for me but when I put the same ViewData code into a Action method that returns a View() it works?
Thanks
I have a json of the following format which I need to send in the Ajax request through POST method:
{
“gbus”: [
{
"code": "*"
}
],
“regions”: [
{
"code": "*"
}
],
“offices”: [
{
"code": "*"
}
],
“contracttypes”: [
{
"code": "*"
}
],
“jobnumbers”: [
{
"code": "*"
}
],
“disciplines”: [
{
"code": "*"
}
]
}
Its not working for me, giving 500 error always when I try to submit it. Please suggest if you have any idea.
For example in the jQuery documentation I find both JSON and JSONP mentioned. What is the difference exactly? How can I see which is which? Which one should be used for what?
And what does the PHP function json_encode generate?
I have a page that comes back as an UnexpectedPage in HtmlUnit, the response is JSON. Can I use HTMLUnit to parse this or will I need an additional library?
How can I return an response (lets say an array) to the client with a name assign to it form a python script.
echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';
in this scenario it returns an array with the name(jsonValidateReturn) assign to it also this can be accessed by jsonValidateReturn[1],so I want to do the same using a python script.
I tried it once but it didn't go well
array_to_js = [vld_id, vld_error, False]
array_to_js[2] = False
jsonValidateReturn = simplejson.dumps(array_to_js)
return HttpResponse(jsonValidateReturn, mimetype='application/json')
Thanks.
Hi everyone,
am trying to read a json file to display its contents in my datagrid but i keep getting an empty grid. Can anyone help with a working example.
Thanks in advance.
var responseFromServer = "{\"flag\":true,\"message\":\"\",\"result\":{\"ServicePermission\":true,\"UserGroupPermission\":true}}";
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
var responseValue = serializer.DeserializeObject(responseFromServer);
responseFromServer value is get a webservice, and then how to get the json string value, such as "flag","Servicepermission"??
Hey guys,
I have this script working fine with OAuth, but I accidentally nuked my 350 API hits with a stupid while statement :( I'm trying to get data from the Twitter API without OAuth, I can't figure it out (still pretty new), heres what I have
<html>
<body>
<center>
<hr />
<br />
<table border="1">
<tr><td>ScreenName</td><td>Followed back?</td></tr>
<?php
//twitter oauth deets
$consumerKey = 'x';
$consumerSecret = 'x';
$oAuthToken = 'x';
$oAuthSecret = 'x';
// Create Twitter API objsect
require_once("twitteroauth.php");
$oauth = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
//get home timeline tweets and it is stored as an array
$youfollow = $oauth->get('http://api.twitter.com/1/friends/ids.json?screen_name=lccountdown');
$i = 0;
//start loop to print our results cutely in a table
while ($i <= 20){
$youfollowid = $youfollow[$i];
$resolve = "http://api.twitter.com/1/friendships/exists.json?user_a=".$youfollow[$i]."&user_b=jwhelton";
$followbacktest = $oauth->get($resolve);
//$homedate= $hometimeline[$i]->created_at;
//$homescreenname = $hometimeline[$i]->user->screen_name;
echo "<tr><td>".$youfollowid."</td><td>".$followbacktest."</td></tr>";
$i++;
}
?>
</table>
</center>
</body>
</html>
Neither of the two Twitter functions require authentication, so how can I get the same results?
Thanks guys,
Dex
I'm working with big blobs of JSON. These blobs change slightly over time and a revision history is kept. I'd really like to be able to do a visual diff on them, but my problem is they're being stored without any formatting at all - everything is on one line, so that makes it a little hard to see what changed.
Is there a good way to programatically format them ala http://jsonformat.com/ or http://jsonformatter.curiousconcept.com/?
Hello, I have a web application. On the client side I basically need to get the values of some fields and turn them into JSON and then send them to the server in an AJAX kind of way.(asynchronous)
How would you do that? I also am using jQuery
Does anyone know of a simple javascript library that serializes a form DOM object to JSON? I know jQuery has the serialize method but since I am writing an app for IE mobile, I can't use any of the new fancy libraries, must be oldschool simple javascript, as light as possible.
Cheers
I was wondering if its possible to use a json-based schema-free, document-based database like Mongodb or Couchdb on a symfony project like its used for ruby-on-rails websites? And if yes, how can it be done?
{"paging": {"pageNum":2,"action":"Next","type":"","availableCacheName":"getAllFunds","selectedCacheName":"","showFrom":101,"showTo":200,"totalRec":289,"pageSize":100},
"Data":[{"sourceCodeId":0,"radio_fund":"individua
l","availableFunds":[],"fundId":288,"searchName":[],"fundName":"Asian Equity Fund A Class Income","srcFundGrpId":"PGI","firstElement":0,"las
tElement":0,"totalElements":0,"pageList":[],"standardExtract":true}]
I have json file with above format with two fileds,one paging and one is Data array.
I able to retrieve values of paging,but i am not able to retrieve the values of data array with .each function of jquery.
Any suggestions or inputs really appreciated.
I have an application created with PhoneGap and Backbone. I upload a file as JSon and my server receive data like this :
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/...
I'm trying to write the file like this :
File.open("#{Rails.root}/public/images/#{self.id}.jpg", "w+") do |f|
f.write(data)
end
It's not working and I don't know what to do. When I'm trying to open the file I have this message "Not a JPEG file: starts with 0x64 0x61".
Do you have a solution?
I'm new to JSON and moving around in it in jQuery. I'm fine until I hit a '[', as in:
"gd$when": [{
"startTime": "2006-11-15",
"endTime": "2006-11-17",
"gd$reminder": [{"minutes": "10"}]
}],
I tried to do a
eventTime = event["gd$when"]["startTime"];
to get to the 'startTime' (Yes, event is the variable for ajax stuff, it's all working fine until I hit the '[')
Thanks for any help.
How do I parse this json with jQuery?
DayEvents : [{"0":"886","event_id":"886","1":"5029","user_id":"5029","2":"Professional","user_type":"Professional", ...
I have an Java class, like Library, that contains many fields. I want do ajax call to server
and in controller's method I want to have partly initialized @RequestBody Library with only
fields, which are present in json object.
Please Help
I am trying to use PHP to make a JSON file. Part of the code is as follow
$array = array("hello", "world");
$string='{"person": [
{
"name":'$array[0];',
"age":'$array[1];'
}
]
}';
The file created. However, $array[0] and $array[1] doesn't return the values "hello" and "world" but as $array[0] and $array[1]
Any idea?
Thanks
I'm looking for the most efficient / standard way of passing data between client-side Javascript code and C# code behind an ASP.NET application. I've been using the following methods to achieve this but they all feel a bit of a fudge.
To pass data from Javascript to the C# code is by setting hidden ASP variables and triggering a postback:
<asp:HiddenField ID="RandomList" runat="server" />
function SetDataField(data) {
document.getElementById('<%=RandomList.ClientID%>').value = data;
}
Then in the C# code I collect the list:
protected void GetData(object sender, EventArgs e)
{
var _list = RandomList.value;
}
Going back the other way I often use either ScriptManager to register a function and pass it data during Page_Load:
ScriptManager.RegisterStartupScript(this.GetType(), "Set","get("Test();",true);
or I add attributes to controls before a post back or during the initialization or pre-rendering stages:
Btn.Attributes.Add("onclick", "DisplayMessage("Hello");");
These methods have served me well and do the job, but they just dont feel complete. Is there a more standard way of passing data between client side Javascript and C# backend code?
Ive seen some posts like this one that describe HtmlElement class; is this something I should look into?
I have a game which I deployed for desktop and Android. I can read JSON data and create my levels, but when it comes to reading JSON files from web app, I get an error that logs, "cannot read the json file".
I researched a lot and I found out that I should add my JSON config class to configurations, so I added this line to gameName.gwt.xml, which is in core folder:
<extend-configuration-property name="gdx.reflect.include"
value="com.las.get.level.LevelConfig"/>
But it did not work out. I have no idea where should I place this line or where I should change to make my web app work, so I can read JSON files.
I have a game which I deployed for desktop and android, I can read json data and create my levels, but the problem is, when it comes to reading json files from web app, I get an error that logs, cannot read the json file, I researched a lot and I found out that I should add my json config class to configurations, I added this line to gameName.gwt.xml, which is in core folder
<extend-configuration-property name="gdx.reflect.include" value="com.las.get.level.LevelConfig"/>
but it did not work out too, I have no idea where should I place this line, or where should I change to make my web app work, so I can read json files