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).
I am writing a VB.NET application which needs to extract data from an XML document. The Dataset.ReadXML function would be suitable, if the XML document was held in a disk file. However I would prefer the XML document to be passed via a string property of my class object, not as a disk file.
Is there a way to make the ReadXML function take its input from a string instead of a file ? If not, are there other functions which can be made to parse XML which is held as a string.?
I'm writing a little web service which generates SO/SF/SU/MSO user flair in the form of an image with various "themes". I find this preferable to using the HTML/JS solutions offered by SO as it's more flexible and also works better in forum signatures.
I'm retrieving the data using the apparently unofficial API (More info here). I can have the data in HTML or JSON. I assumed the JSON would be easier to parse.
Unfortunately, I'm not great at regexes. and the best I can come up with is some very hacky sub-stringing. I believe a regex should be the most elegant solution
regex that matches ID, GravatarURL, ProfileURL, DisplayName, Reputation and Badge Counts (Bronze/Silver/Gold).
FWIW This is to be used in a VB.Net project (in case that affects the syntax at all)
[Code].....
In case any of you are interested, some screenshots of the flair as a work in progress are available here: Me, Jeff Atwood, Joel Spolsky
how to parse and extract specific elements out of a JSON that I obtain from a web source. Using Visual Studio 2010 and VB. I can get the JSON but I haven't been able to find any examples or tutorials regarding parsing the data, locating specific elements and their associated data.
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.
Alright I have been trying to figure this out and I read the MSDN page on the JavaScriptSerializer. However, I still can't figure out how to get this to work on an asp.net page. I want to convert my dataset into a json string so I can graph it using FLOT(graphing tool) imports System.Web.Script.Serialization
dim myObject = dataset.getxml()dim jsonString = new JavaScriptSerializer().Serialize(myObject)
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.
I have a field that I display via: String.Format({0:c},amount) This produces the string "$28.28" However, when I try to convert back to a decimal amount, I get an incorrect format exception: amount = Decimal.Parse(amount.Text, NumberStyles.Currency) I also tried it with NumberStyles.AllowCurrencySymbol with the same results. I verified that the value in amount.Text is "$28.28". Am I missing something? Shouldn't these two operations use the same currency symbol and formats?
I am trying to deserialize a JSON string using VB.net and cannot seem to pull the values out of the finished List.[code]I am told "Index was out of range. Must be non-negative and less than the size of the collection."
I've the following JSON string to deserialize: [{"application_id":"1","application_package":"abc"},{"application_id":"2","application_package":"xyz"}]
I'm using DataContractJsonSerializer method. It is made up of array of items and I couldn't find an example using VB.Net that can deserialize this structure. I have the following Application class to store this information: <DataContract(Namespace:="")> _ Public Class ApplicationItem <DataMember(Name:="application_id")> [Code] .....
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?
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 ".
I'm trying to create this JSON string but having problem creating it.I'm getting System.NullReferenceException error.Here is the json string that I would like to create{"id":["1","2","3","4"]},"sid":["s1","s2","s3","s4"]}Here is the code I have so far.
Imports System.Web.Services Imports System.Data Partial Class test_sidetab
I was using a JSON MAKER class to make a JSON string to send off from my webservice - it was way too slow - so I thought I would do the string manipulation right in the recordset loop - how could I go wrong - it is only 1141 records![code]...
I have written a program that uses an array of the english alphabet and Morse code. I also built a form with a input box for the alphabetic information and an output box with the Morse Code. What i am trying to do is basically type a word like "Hi" in the input box and produce the Morse Code equivalent in the Morse Code output box. [Code] This works but only one letter at a time. Do i need to Parse the string of characters one at a time, and then run it through a loop like i have created?
{"AliasName": "ysiCountryInfo", "DataClass": {"Description":"United States 111","Code":"usa","WriteOffTaxPointAdjustment":0,"IndexationRounding":6}} I would like to deserialize object into below class
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?
I have created a function which essentially enables me to output anything I need from my database in a similar method to Facebook's FQL querying method as a JSON text result. I can also use the same function to get the output as a Dictionary, or List of(Dictionary) to use with VB functions for other purposes.
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).
I am making a change to an existing process. Currently the csv file (which can have embedded "," with the field in quotes), i being passed as an IO.StreamReader parameter pStreamReader.
dim vLine as string = pStreamReader.ReadLine dim vFields () as String = vLine.Split(","c)
Well ... obviously the split does not work with embedded commas in a field. Looked at TextFieldParser, but it is in the FileIO class and the module is passed a IO.StreamReader. Can it work?
Or how abour a RegEx? Does anyone have any suggestions? I have look around on the internet and it seems like a common questions with a bunch of wild goose chases.
I am making a change to an existing process. Currently the csv file (which can have embedded "," with the field in quotes), i being passed as an IO.StreamReader, pStreamReader to my module.
The code reads ....
dim vLine as string = pStreamReader.ReadLine dim vFields () as String = vLine.Split(","c)
Well ... obviously the split does not work with embedded commas in a field. Looked at TextFieldParser, but it is in the FileIO class and the module is passed a IO.StreamReader.
Or how abour a RegEx? I have look around on the internet and it seems like a common questions with a bunch of wild goose chases.