If I have a web service (.asmx) and I want it to use Json.NET to serialize all the objects that I return from that web service, is there a way to do that?
In other words, I have a class like this:
[JsonObject(MemberSerialization.OptOut)]
public partial class Person
{
public string FirstName {get; set;}
publ...
I have a web application which uses JSON.Net to write out an array of data from a .Net Array().
When run in the VS2010 environment, it works fine.
When run under IIS6 and .Net 3.5, it works fine.
When run under IIS7 or 7.5 and .Net 3.5 when .Net 4.0 is installed (but the app pool and site is set to use v2 runtime), it fails with the e...
i have the following json string (jsonString)
[
{
"name":"Fruits",
"references":[
{"stream":{"type":"reference","size":"original",id":"1"}},
],
"arts":[
{"stream":{"type":"art","size":"original","id":"4"}},
{"stream":{"type":"art","size":"medium","id":"9"}},
]
}
]
and the following C# objects
class Item
{...
I have a REST service which takes JSON and XML as input and does a SOAP call to an extenal service with the deserialized content. The classes which are used for deserialization are auto-generated from the wsdl of the SOAP service. I use the XmlSerializer in case of a XML request and I want to use the Newton JSON.NET JsonSerializer for JS...
just curious if there is an alternative solution to the Json.Net library from james newton king
...
I am trying to parse out data from oodle.com api feed using the JSON.NET lib. Part of the response JSON string to deserialize has the following 'location' structure:
"location":{
"address":"123 foo Street",
"zip":"94102",
"citycode":"usa:ca:sanfrancisco:downtown",
"name":"San Francisco (Downtown)",
"state":"CA",
"country":"USA",
"latitu...
I'm trying to serialize/deserialize a Dictionary<string, object> which seems to work fine if the object is a simple type but doesn't work when the object is more complex.
I have this class:
public class UrlStatus
{
public int Status { get; set; }
public string Url { get; set; }
}
In my dictionary I add a List<UrlStatus> with a key ...
I'm using JSON.NET as a quick and dirty way of serializing an object to a string. It is being used as part of a logging framework, which means the output will need to be as human readable as possible.
JSON.NET is good in that we can turn on Formatting.Indented for human readability, but say the StackTrace property inside an Exception. I...
I have the following:
public class MyClass : SuperClass {
[JsonProperty]
public virtual string Id { get; set; }
}
public abstract class SuperClass {
public int GetHashCode() {
//do things here
}
}
I cannot alter SuperClass. When I go to serialize to Json using JsonNet I'll do something like this:
JsonSerializerSet...
I've been toying around with Json.NET and I'm liking it a lot. However, I've run into a problem when deserializing objects with value-type members. For example, consider this code:
public struct Vector
{
public float X;
public float Y;
public float Z;
public override string ToString()
{
return string.Format(...
Hi all
I'm coding in C# for the .NET Framework 3.5.
I am trying to parse some Json to a JObject.
The Json is as follows:
{
"TBox": {
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2 },
"TBox": {
"Name": "MedBox",
"Length": 5,
"Width": 10,
"Height": 10 },
...
Hi ,
I have to pass my Json data in a particular format.
My app is coded in vb.
The following is my code :
Dim jsonObject As New Json.JsonObject
jsonObject.Item("count") = New Json.JsonNumber("0")
jsonObject.Item("data") = New Json.JsonArray("")
**jsonObject.Item("success") = New Json.JsonString("True")**
The Probl...
I am trying to serialize something like this Dictionary. I also want to preserve the type information.
By default, it appears json.net calls ToString() on the key. So that the resulting json is something like
{$type':'System.Collections.Generic.Dictionary`2[[Person, myAssembly],[System.Int32, mscorlib]],
'Person',100,
'Person...
I am using http://json.codeplex.com/ and I am talking to a Ruby based Rest API. Problem is that most of the propertys have a ruby underscore naming convention. I am wondering if anyone knows of a way so that I can avoid having to Add lots of JsonProperty.
For example I want to avoid adding the JsonProperty attribute and have a conventio...
This is a little embarrassing question but here it goes.
I have a hidden asp.net field that gets populated with a json string just before post back.
I use JSON.stringify to set the value of the field like this
function prepareForSave() {
var commissionSplits = new Array;
$("input[id$='ctlBidAgentId']").e...
Anyone having JSON builer/parser for .NETCF (Compact Framework) 2.0 version?
...
I'm trying to do some simple JSON manipulation on the Windows Phone 7. JSON.NET looks great, but VS2010 complains when I try to add a reference to it.
It let me add the Silverlight dll, but warned me that it could result in weird app behavior, so I'm skeptical that it would actually work.
This looks like a fine way to serialize and des...
Hi all,
I've got a 2 dimensional of values in JSON format:
[[57, 2], [57, 2], [58, 2], [55, 2], [60, 2], [54, 1], [59, 11]]
Each of the pairs actually contains a pair of unrelated readings, and there is one pair for each minute. So in the first min, reading 1 is 57 and reading 2 is 2 and in the second minute, the readings are the same...
I have JSON like this:
{
"Property":"Blah blah",
"Dictionary": {
"Key1" : "Value1",
"Key2" : "Value2",
"Key3" : "Value3"
}
}
I want to extract the "Dictionary" object as a Dictionary (so it'd be like Key1 => Value1, etc.). If I just had the "Dictionary" object directly, I could use:
JsonConvert.Dese...