Asp.net - Create JSON Data With .NET?
Jun 23, 2011
At the moment, I am building json data as follows:
<%@ Page Language="VB" Debug="True" EnableViewState="false" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
[Code].....
Is this the preferred method of creating JSON data using .NET?
I think I am supposed to use asmx web services with arrays converted to json? But all the examples I have seen are in C#.
View 5 Replies
ADVERTISEMENT
May 9, 2012
I am attempting to create a class in vb.net from the below JSON example.I am fairly new to JSON, and I am just having trouble figuring out the correct way of doing this. I have looked at numerous examples of how to do this but they are in much simpler formats than the one I am providing below.
[Code]...
I am guessing this is poorly worded, but I am struggling to find a good example of how this would be done. I need to have the class correctly formatted so when I deserialize into the class it works without error.
View 1 Replies
Oct 23, 2011
I'm trying to create an app in Visual Basic that will allow a user to input an address, state, zip, some radio buttons and other data that will then add information into a json file.
[Code]...
View 1 Replies
Mar 5, 2012
How to create this JSON array using vb.net array [code]...
View 1 Replies
May 9, 2012
I am been stuck on this for 3 days now...I have been accessing the twitter api to pull a user_timeline for a list of users and the json that comes back is impossible to work with. I tried to deserialize it using javascriptserializer and get an error:invalid object passed in , ':' or '}'
Now this is frustrating since I expect the json being returned to be error free. Then I tried json.net and split the posts using string.split and tried to convert each post to Jobject or jarray. for Jarray I get
'unexpected end of content while loading jArray
[Code]...
Now I have formatted the code here and not pasted the whole file but it does look like valid json to me and I do not alter anything after receiving the stream from the twitter api. Can someone please point me in the right direction? I really need to get this stuff parsed?
View 1 Replies
Sep 8, 2009
I want to create a json object in vb.net to send the response back javascript function to do something?
View 2 Replies
Feb 21, 2011
I'm strugling the whole day with the next JSON string
{
"0":{"link":"afbeeldingenplaatje1.jpg"},
"1":{"link":"afbeeldingenplaatje2.jpg"},
"2":{"link":"afbeeldingenplaatje3.jpg"}
}
How can i deserialize this? What's wrong with the next code (vb.net)
Public Class DataString
Private m_link As String
Public Property link() As String
Get
[CODE]...
It returns always an empty result.
View 1 Replies
Jul 28, 2011
how to receive and send back json. Hope someone can help me on this. I understand by examples.
On my clientside, I am sending a ajax json string "name":"theName" to the server side and would like the server side to return a string saying "welcome &name ".
Client-side code
<!DOCTYPE html>
<html>
[Code]....
View 2 Replies
Nov 12, 2010
Below is my JSON formated String
{"AliasName": "ysiCountryInfo", "DataClass": {"Description":"United States 111","Code":"usa","WriteOffTaxPointAdjustment":0,"IndexationRounding":6}}
I would like to deserialize object into below class
[code].....
View 1 Replies
Jan 18, 2012
I have a JSON response from a web service that I need to be converted to an object then to an array. My response is similar to the one below:
{"status":{"error":"NO","code":"200","description":"none","message":"Request ok"},"geolocation":{"lat":"38.89515","lng":"-77.0310"},"stations":[{"country":"United States","regPrice":"0.00","midPrice":"0.00","prePrice":"0.00","streetAddress":"1401, I St[code]....
I am doing this is VB.NET within a console for now. Basically I am trying to create a simple way to test my API calls and output the information. What I am trying to accomplish is having to loop through the JSON array and list the stations.
View 3 Replies
Feb 7, 2011
I have the following jquery which is invalid:
{
"id": 12,
"heading": "heading goes here 3",
"content": "<p><span style="color: #ff0000;">content</span> <u><strong>goes </strong></u><span style="color: #ffffff;"><span style="background-color: #ff0000;">here</span></span> 3.</p>"
}
I am generating this with asp.net (vb.net) from data stored in a database. I think I need to somehow escape the double quotes within the content section of the json data. How do I do this?
View 2 Replies
May 5, 2011
I have a Customer JSON object created which has value as below:[code]I need to get this data in the Handlers/CustomerHandler.ashx to do some DB operations.[code]
View 3 Replies
Jun 22, 2010
I have successfully returned data from a ASP.Net webservice in JSON format (using a service method that required no parameters) but have struggled with making a webservice call that requires a parameter.
Webservice:
[Code]...
View 1 Replies
Oct 8, 2010
I have to pass my Json data in a particular format. My app is coded in vb. The following is my code :
[Code]...
View 1 Replies
Sep 2, 2010
I'm just starting to really get into JSON as a tool for my sites. I was showing my friend how I am calling a WS and returning the data, and he asked me about security of passing JSON data to and from a web service as he saw the data from the "POST" (via Firebug). Many of our public facing sites deal with member information and contain PHI.
Can I encrypt the JSON data and then unencrypt it? Is that a good way to go about it to ensure a layer of protection? Or is there another "better/right" way of doing it? Or are his concerns unfounded? how to encrypt or secure the JSON data when needed? Just trying to gather as much knowledge as possible before I go down a path that won't work for the company.
View 4 Replies
May 3, 2011
this is the JSON string the data is required in to be sent using a given URL.[code]I am using VB.net and i need to create this string using VB.net. I tried using namevaluecollection and doing a POST. I also tried making a string and send data using GET. Both failed. how can i do this?
View 2 Replies
Mar 25, 2011
I have an existing WSDL which returns information to remote devices using SOAP. However, I'm writing a new app with Android which doesn't support SOAP so I can't use the existing WSDL and have had to code a new app which looks for a querystring from the Android app and returns the data in a JSON packet. I've coded the module which receives the data okay but I'm unsure how to send the data back in JSON forma
View 1 Replies
Aug 17, 2011
I'm new at JSON and i am currently struggling with a problem parsing JSON data in a list of objects.The data that i am trying to parse is generated by the facebook graph api, and looks like this :
{
"100001621071794": {
"id": "100001621071794",
"name": "TEST1",[code].....
I know that this is not an array, because it is missing '[' and ']'. But when i replace the '{' and '}' with '[' and ']' i'm getting an error because of an invlaid matrix.
View 1 Replies
Jul 17, 2011
How can I convert a JSON string to an array OR a JSON string to XML in VB.NET? I know how to do this in C#, as I have read dozens of articles on it, however, I am unable to figure out how to achieve the same result in VB.NET.
I'm using the System.Web.Script namespace via System.Web.Extensions.dll (from Microsoft).
I'm willing to use an additional DLL file if needed.
View 1 Replies
Mar 2, 2010
I'm sure this has been asked before but I'm not finding quite the information I'm needing so I thought I'd post this.
I've written a PHP script that returns a simple JSON object that looks like this:
{"status":"success","level":"admin"}
I'm doing a standard web request that submits the required data to the script over the internet and that's working fine.
Now, I want to use JSON.NET to pull out the individual variables so I can know what the values of "status" and "level" are. The problem is, I have no idea where to start.
I'm doing this in VB.NET (on the .NET Compact Framework).
View 1 Replies
Jan 13, 2012
[URL] Using this I have managed to use Server Side Web Methods to perform actions with AJAX.In most instances, I just need it to do stuff (save things to a database for example) so don't need to do anything with the response, but now I've come across a situation where I do, and I can't work it out!The Web Method returns a JSON object, which looks like this:
{"d":"[{"validDetails":"True","lateAlert":"","LoginResponse":"Logging in Jamie at 16:53 please wait"}]"}
This is the output shown from Firebug. I am not sure what the 's are, but bear with it...The AJAX call and attempt at outputting this response is:
$("form").on("submit", function () {
var LogonObject = new Object;
LogonObject.password = $('#password').val();
[code]....
And several other variations from info I have found on Google and SO, but it seems to treat the results variable as a string, not an array, and the output I get on the alerts is each individual character, ie;
[, {, ", v, a, l, i, d, D... etc
So I wondered if results needed to be converted to JSON again (though I don't know why) so I tried
results = $.parseJSON(data.d)
But that didn't work either.
EDIT, the code which generates the response (missing out tons of logic, but this is the important bit):
Public Class OutputObject
Public validDetails, lateAlert, LoginResponse As String 'content of JSON output'
End Class
[code].....
View 2 Replies
May 18, 2009
I am trying to read JSON data from a server to a dataset object, any idea on how this can be done. I have tried using the DataContractJsonSerializer class but it only seems to work for objects.
JSON Data
{
"firstName": "John",
"lastName": "Smith",
[code]....
The code above works to an object, but I want to parse the JSON data to a dataset object.
View 2 Replies
Mar 28, 2011
I am looking for a vb.net library where I can insert data into an object and have it spit out a json formatted string, and also take the string in again to rebuild the object.I am not that concerned with mapping it to preexisting objects.I have searched around and every single library I've found either can't read the strings in again, interprets them as one long string instead of breaking them up into parts, or fails to work entirely (asp.net can't even find any public members).
View 1 Replies
Aug 23, 2011
I have a task to create a web service to receive client-side app's http request(with rpc={json data} in the end), deserilize it and put he parameter in stored Procedure in order to retrive data from sql server. the procedure query and client-side's app are already there and the return data to client-side app is JSON too
View 1 Replies
Feb 15, 2011
I am accessing the facebook api and using the json.net library (newtonsoft.json.net)I declare a Jobject to parse the content and look for the specific elements and get their values. Everything works fine for the first few but then I get this unexplained nullexception error " (Object reference not set to an instance of an object)Now I took a look at the declaration but cannot see how to change it. Dim jobj as JObject = JObject.Parse(responseData) message = jobj("message").tostring
The error occurs at the last line above.I check to see if message is null and then look for the next desired field as follows
[Code]...
This is one example where "message" does not appear in the first few lines but appears later. So what I do is look for position of message and description and which ever is first go and get that and if I get an error or the fields do not return anything, I try and parse by regex and even that is not working right.
View 1 Replies
Nov 24, 2011
I have two experimental web services. One is an asmx contained within a .net web application. The other is a WCF service library being invoked from the web application.The asmx basically does everything I need, but I think WCF would be better, except that it doesn't do anything as I would expect after fiddling with the asmx service.For example, the same method behaves differently in each:
' ASMX
<WebMethod(BufferResponse:=True, EnableSession:=False)>
Function Test(aObject as Object) as Object
' object will have been successfully serializaed into a dictionary
[code]...
View 3 Replies
Nov 28, 2010
I want to create a class is it where I can do...
[code]...
How do I do this? Do i create a class and create a instance of CarData? but how do I add Color and Year etc to it?
View 3 Replies
Jun 13, 2011
I have to send a request to Webservice and I have a working PHP solution, that I have to translate in VB.net
Here's the code working in PHP
//fill in the details of the contacts.userId is obtained from loginResult.
$contactData = array('lastname'=>'Valiant', 'assigned_user_id'=>$userId);
//encode the object in JSON format to communicate with the server.
[code]....
Naturally I imported a reference to a Json library and Imported (Imports Newtonsoft.Json)?
View 1 Replies
Oct 22, 2010
I have used VB (versions 2 - 6) through many years; however, I am crash-course training myself into the VB2008 / VB2010 world kicking a screaming. I would like suggestions as to what SQL database access method should I focus more on in my learning process without making me feel that I'm a million years behind. I know I have WinForms where I can create a datasourse and drag / drop fields or tables on a form to create a grid (not really what I'm looking for).
My trouble isn't so much designing the form but in how I access the database. Theres XML, LINQ to SQL, ADO.NET, and many other methods. Not only do I need to grasp these methods quickly but I also need to know what type of projects I should create. What I mean is...I was thinking that I would design a WinForm app; however, I see that there are WPF apps and others to chose from. This is getting deep. I know it depends on the project that I'm working on. My plans are to write an app based off of either an SQL Express 2008 or SQL Server 2008 database. This first app will be standalone for now but may later become multi-user. I know I'm far behind on my learning curve coming from VB6. I have read a bit on VB2005 / 2008 / 2010. I own
both VB2008 and VB2010. I use VB2008 at work. I know ADO.NET is still alive but by what I read online, it's a dying method and is only kept for backward compatibility. XML and LINQ to SQL and other methods are all pretty new to me.
View 1 Replies
Dec 8, 2010
i want to create a table that include a current year data and as well as previous data to be compare. here is the example of the table that i want to create: but i want to compare one of the annual data with the previous year. as example i want to compare between the data of current AR of 2007 with the current AR for 2006, Current AR of 2006 with current AR for 2005 and go on~, but i have no idea how to do it.
View 1 Replies